<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zesty_tech</title>
    <description>The latest articles on DEV Community by Zesty_tech (@zesty_tech).</description>
    <link>https://dev.to/zesty_tech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1057959%2F95fa05e2-fc6f-4ac4-861c-22c5b7537167.png</url>
      <title>DEV Community: Zesty_tech</title>
      <link>https://dev.to/zesty_tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zesty_tech"/>
    <language>en</language>
    <item>
      <title>Improving Storage Efficiency for Solr &amp; Elasticsearch</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Wed, 29 Nov 2023 10:07:43 +0000</pubDate>
      <link>https://dev.to/zesty_tech/improving-storage-efficiency-for-solr-elasticsearch-15ng</link>
      <guid>https://dev.to/zesty_tech/improving-storage-efficiency-for-solr-elasticsearch-15ng</guid>
      <description>&lt;p&gt;&lt;em&gt;By: Omer Hamerman, Principal DevOps Engineer at Zesty&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As a software engineer, I saw heaps of data become mountains. Storage became cheaper, and organizations started saving more and more data. But that data isn’t worth much if you can’t browse or analyze it. &lt;/p&gt;

&lt;p&gt;When searching for solutions to this problem, I found search engines like Solr and Elasticsearch helped me leverage this data via reverse indexing and machine learning algorithms. I managed e-commerce stores, and while they come with a nice list of predefined fields (e.g., size, color, fabric), the product descriptions were unstructured data that could still carry valuable information for the customers. With a full-text search, I could improve user experience without manually forcing the description into an artificial structure. &lt;/p&gt;

&lt;p&gt;But, when I started using search engines, I often struggled with resource requirement estimation. I learned that even &lt;a href="https://lucidworks.com/post/estimating-memory-and-storage-for-lucenesolr/"&gt;the creators of these systems recommend iterative approaches&lt;/a&gt; where I have to reevaluate my needs frequently. Over the years, I embraced this approach and found ways to get my resources under control.&lt;/p&gt;

&lt;p&gt;Storage is one of these resources. I’ll explain some of the methods I found to enhance the performance and lower my Solr and Elasticsearch deployment costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Do Search Engines Work?
&lt;/h2&gt;

&lt;p&gt;A search engine like Solr or Elasticsearch is a document database that helps users find specific documents. It creates different indexes for each document field. This means every document field can have one or more associated indexes enabling different types of searches.&lt;/p&gt;

&lt;p&gt;For example, a reverse index allows users to search for documents with specific words. The index works by creating a lookup table of all used words. Each word is linked to a list of documents containing this given word. When searching for a comment, the engine doesn’t have to check each document for the word; it simply looks up the word in the index and returns the associated documents.&lt;/p&gt;

&lt;p&gt;Unlike relational databases, which try to eliminate data duplicates to improve consistency and storage footprints, a search engine is optimized for data searchability and access. This means that a data set saved in a relational database is usually much smaller than when stored in a search engine, which has ramifications when it comes to storage costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which Storage Factors Can Impact Search Performance and Costs?
&lt;/h2&gt;

&lt;p&gt;When it comes to search engines, I’ve found that different storage factors influence the performance and costs of my searches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disk I/O
&lt;/h2&gt;

&lt;p&gt;Using disks with low I/O specs has a negative impact on search performance. A slow disk can drastically prolong the response times of a search engine, especially when the workload includes huge indices or complex queries.&lt;/p&gt;

&lt;p&gt;If you’re running an e-commerce site, you probably know slow responses are correlated with bounce rates, meaning saving on disk I/O can result in the indirect cost of losing customers. To keep your customers happy, you want to keep response times low. But the only way to do this while using slow disks is excessive caching in memory, which, in turn, raises costs again—and often to the degree that your savings on I/O evaporate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Storage Capacity
&lt;/h2&gt;

&lt;p&gt;Another issue I encountered was insufficient storage capacity. Search engines work by building indexes for the data they ingest. One approach for this is to create a lookup table that uses each word in the data as a key and a list of documents including that word as a value. Most words are used in many documents, so these indexes become large quickly. &lt;/p&gt;

&lt;p&gt;Insufficient storage capacity can limit the size of these indexes and, in turn, their performance. But more storage can raise your monthly bill.&lt;/p&gt;

&lt;p&gt;Take the e-commerce example. Some of these sites have thousands of products, in dozens of categories, and each of them has descriptions that need to be searchable. Since descriptions for products of the same category have a high probability of sharing many words, each index entry for a word can get really big because it’s used in many places. Storage limits will impact the size of the index, only allowing a subset of words or products to be searchable.&lt;/p&gt;

&lt;p&gt;Then there’s the question of how long the data needs to be retained and how far back the backups should go. If I choose retention times that are too short, I might save money but reindex too often, which hurts performance. If retention times are too long, I can use my indexes for a longer period, but, again, I’ll increase costs. The same is true for backups. More storage for backups can lower the risk if things go wrong; but while cheaper than live storage for an active search engine, storage for backups isn’t free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improving Storage Performance and Cost Efficiency
&lt;/h2&gt;

&lt;p&gt;I used several different optimization methods to help me get the most out of my search engines. Make sure to integrate each method into a recurring process to reevaluate each requirement with up-to-date production data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mapping Document Fields
&lt;/h2&gt;

&lt;p&gt;Mapping is the process of defining how a search engine should index each document field. Usually, this process is done automatically when I save a new document, but creating mappings manually is a good idea to improve performance and save costs.&lt;/p&gt;

&lt;p&gt;The default mapping algorithm generates two mappings for text fields—one for a full-text search index and one for a keyword search index. &lt;/p&gt;

&lt;p&gt;Full-text search is good for fuzzy searches in continuous text because I might want to search for words that are similar to “scarf” and expect to find documents that may only include “scarves.” &lt;/p&gt;

&lt;p&gt;Keyword mapping is less flexible, but if I have fields like clothing sizes, I know that we only sell five sizes, meaning I don’t need that fuzziness. Depending on the use case, having two indexes for each text field wastes storage and slows the system down.&lt;/p&gt;

&lt;p&gt;I also disable the mapping of specific fields entirely, preventing the search engine from creating an index. This way, the search engine doesn’t need to index the entire data set, lowering the bill accordingly.&lt;/p&gt;

&lt;p&gt;I always check what fields my documents have and make sure to choose the best mapping for each.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining Data Retention, Replication, and Backup Policies
&lt;/h2&gt;

&lt;p&gt;There are a few best practices I follow to optimize storage performance and cost efficiency. &lt;/p&gt;

&lt;p&gt;First, I define data retention policies based on business requirements and consider implementing data lifecycle management strategies to optimize storage costs. Moving older data into slower storage can save money while keeping the data around if it’s needed in the future. But the cheapest storage is no storage at all, so I check to know which data to retain. I want to keep fast indexes for popular products, but might want to save a bit of money on the more niche inventory.&lt;/p&gt;

&lt;p&gt;Replication is important for reliability and performance. After all, I choose a search engine because it lets my users search for data faster. So replicating it close to users can lower latency, which in the case of my e-commerce stores, had a positive impact on revenue. Again, don’t go overboard here; subsecond responses might seem nice on paper but aren’t a requirement for all interactions on my website.&lt;/p&gt;

&lt;p&gt;Finally, I assess my backup requirements. Replicas can reduce the risk of needing a backup, but can’t eliminate it completely. I make sure I have a backup to restore past states if my data is destroyed but also keep it reasonable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automating Recurring Storage Estimations
&lt;/h2&gt;

&lt;p&gt;To get the most out of my search engine, I ensure my storage system can handle the required read-and-write operations efficiently. This means choosing the right storage type and provisioning it with the correct size. On the other hand, I don’t want to go overboard with my resources. Storage that isn’t used still costs money, so I want to provide as much as necessary, but no more. Usually, this requires a manual resource estimation process, but tools like &lt;a href="https://zesty.co/zesty-disk/"&gt;Zesty Disk&lt;/a&gt; automate this chore.&lt;/p&gt;

&lt;p&gt;Zesty Disk is a block storage auto-scaler that automatically expands and shrinks block storage. In fashion e-commerce stores, where products change each season, the indexes grow and shrink frequently, and with this, the storage requirements too. Zesty Disk will add volumes to my filesystem so I always have exactly what I need, plus a buffer for new data. And if I remove indexes or documents from the search engine, Zesty Disk will remove volumes and recoup expenses by removing capacity that’s no longer needed.&lt;/p&gt;

&lt;p&gt;This behavior perfectly aligns with the need to re-estimate resource requirements regularly. I might not know how much storage a search engine will need in the future, but when resizing disks in short time frames, I can be as close as possible to the optimal space needed by using Zesty Disk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Search engines, like Solr and Elasticsearch, let users query data in a flexible way, which is crucial in times of ever-growing mountains of information. But, resource allocation becomes an issue that requires an operator to reevaluate resource requirements continuously. Each season, I had to check how our inventory changed to ensure the resources could handle it.&lt;/p&gt;

&lt;p&gt;Automatic scaling solutions made my life much easier. They can scan the current load resources have to handle and decide how to scale them up and down without constant manual intervention by an operator. It’s even better if such a solution is capable of leveraging performance optimizations like burst capacity by provisioning small storage volumes. That way, I’m not only saving money but also ensuring performance is never lacking.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally published on the &lt;a href="https://zesty.co/blogs/"&gt;Zesty Blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>solr</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Optimizing Resource Utilization: the Benefits and Challenges of Bin Packing in Kubernetes</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Tue, 28 Nov 2023 08:39:41 +0000</pubDate>
      <link>https://dev.to/zesty_tech/optimizing-resource-utilization-the-benefits-and-challenges-of-bin-packing-in-kubernetes-1h3a</link>
      <guid>https://dev.to/zesty_tech/optimizing-resource-utilization-the-benefits-and-challenges-of-bin-packing-in-kubernetes-1h3a</guid>
      <description>&lt;p&gt;&lt;em&gt;By: Omer Hamerman, Principal DevOps Engineer at Zesty&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Challenges in bin packing include balancing density versus workload isolation and distribution, as well as the risks of overpacking a node, which can lead to resource contention and performance degradation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubernetes provides scheduling strategies such as resource requests and limits, pod affinity and anti-affinity rules, and pod topology spread constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Examples of effective bin packing in Kubernetes include stateless applications, database instances, batch processing, and machine learning workloads, where resource utilization and performance can be optimized through strategic placement of containers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best practices for bin packing include careful planning and testing, right-sizing nodes and containers, and continuous monitoring and adjustment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implementing bin packing in Kubernetes can also have a positive environmental impact by reducing energy consumption and lowering greenhouse gas emissions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Given Kubernetes' status as the de facto standard for container orchestration, organizations are continually seeking ways to &lt;a href="https://zesty.co/"&gt;optimize resource utilization&lt;/a&gt; in their clusters. One such technique is bin packing: the efficient allocation of resources within a cluster to minimize the number of nodes required for running a workload. Bin packing lets organizations save costs by reducing the number of nodes necessary to support their applications.&lt;/p&gt;

&lt;p&gt;The concept of bin packing in Kubernetes involves strategically placing containers, or "bins," within nodes to maximize resource utilization while minimizing wasted resources. When done effectively, bin packing can lead to more efficient use of hardware resources and lower infrastructure costs. This is particularly important in cloud environments where infra spend makes up a significant portion of IT expenses.&lt;/p&gt;

&lt;p&gt;In this article, we will explore the complications of bin packing in Kubernetes, discuss the challenges and trade-offs associated with this approach, and provide examples and best practices for implementing bin packing in your organization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges of Bin Packing in Kubernetes
&lt;/h2&gt;

&lt;p&gt;While bin packing in Kubernetes offers significant benefits in terms of resource utilization and cost savings, it also presents some challenges that need to be addressed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Density vs. Workload Isolation and Distribution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the main issues when implementing bin packing is finding a balance between maximizing resource density and maintaining workload isolation while ensuring the distribution of workloads across systems and availability zones (AZs) for resilience against hardware failures. Packing containers tightly onto nodes can lead to better resource utilization, but it can also increase the risk of contention for shared resources, such as CPU and memory.&lt;/p&gt;

&lt;p&gt;This can result in performance degradation and potentially affect the stability of the entire cluster. Moreover, excessive bin packing can contradict the concept of distribution, presenting dangers to the system's ability to sustain hardware failures. Therefore, it is essential to apply bin packing strategies judiciously and only when the use case makes sense, taking into account both resource optimization and system resilience.&lt;/p&gt;

&lt;p&gt;To further understand the implications of this trade-off, it's worth considering the impact of increasing density on the fault tolerance of your cluster. When containers are packed tightly onto a smaller number of nodes, the failure of a single node can have a more significant impact on the overall health and availability of your applications. This raises the question: how can you strike a balance between cost savings and ensuring your workloads are resilient to potential failures?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Risks of Over Centralizing Applications in the Node&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The risk of excessively bin-packing applications in a node, is the opposite of maintaining the "best-practice" of a distributed deployment. It's the classic risk management mistake of having all your eggs in one basket. It's an operational risk so that if your node dies, it means a bigger chunk of your deployment will be down with it. Therefore, on the one hand, you want to be distributed as possible for the sake of resiliency. On the other hand, you want to keep your costs under control and bin packing is a good solution for this. The magic is in finding the sweet spot in this balance of considerations.&lt;/p&gt;

&lt;p&gt;These issues become more pronounced when multiple containers vie for the limited resources, like memory or CPU, available on a single node, resulting in resource starvation and suboptimal application performance. Additionally, scaling the system in a non-gradual manner or in bursts can also cause unwanted failures, further exacerbating these challenges. To manage these inconsistencies it helps to set policy limits, where you can ensure the reliable supply of resources to applications.&lt;/p&gt;

&lt;p&gt;Another aspect to consider when overpacking a node is the potential effect on maintenance and updates. With more containers running on a single node, the impact of maintenance tasks or software updates can be magnified, possibly leading to more extended periods of downtime or reduced performance for your applications. How can you manage updates and maintenance without negatively affecting the performance of your workloads when using bin packing is a critical question to consider.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scheduling Strategies to Address the Challenges&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes provides several scheduling strategies to help remediate issues related to bin packing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"&gt;Resource requests and limits&lt;/a&gt; let you configure the Kubernetes scheduler to consider the available resources on each node when making scheduling decisions. This enables you to place containers on nodes with the appropriate amount of resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity"&gt;Pod affinity and anti-affinity rules&lt;/a&gt; allow you to specify which nodes a pod should or should not be placed on based on the presence of other pods. This can help ensure that workloads are spread evenly across the cluster or grouped together on certain nodes based on specific requirements. For example, data-critical systems, such as those handling essential customer data for production functionality, need to be distributed as much as possible to enhance reliability and performance. This approach can reduce the risk of single points of failure and promote better overall system resilience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/"&gt;Pod topology spread constraints&lt;/a&gt; enable you to control how pods are distributed across nodes, considering factors such as zone or region. By using these, you can ensure that workloads are evenly distributed, minimizing the risk of overloading a single node and improving overall cluster resilience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By carefully considering and implementing these scheduling strategies, you can effectively address the challenges of bin packing in Kubernetes while maintaining optimal resource utilization and performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples of Bin Packing in Kubernetes
&lt;/h2&gt;

&lt;p&gt;There are various examples of how Kubernetes can effectively implement bin packing for different types of workloads, from stateless web applications to database instances and beyond. We'll explore some of them below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateless Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes can pack multiple instances of stateless applications into a single node while ensuring that each instance has sufficient resources. By using resource requests and limits, you can guide the Kubernetes scheduler to allocate the appropriate amount of CPU and memory for each instance. As long as the instances have enough resources, they will be up and running and ensure high availability for stateless applications such as web or client-facing apps&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database Instances&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When dealing with databases, Kubernetes can effectively pack individual instances of different stateful applications into nodes to maximize throughput and minimize latency. By leveraging pod affinity rules, you can ensure that database instances are placed on nodes with the necessary volumes and proximity to other components, such as cache servers or application servers. This can help optimize resource usage while maintaining high performance and low latency for database operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Batch Processing and Machine Learning Workloads&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bin packing can also be beneficial for batch processing and machine learning workloads. Kubernetes can use pod topology spread constraints to ensure these workloads are evenly distributed across nodes, preventing resource contention and maintaining optimal performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Large Clusters with Many Nodes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In cases where a service needs to be distributed to a large number of nodes (e.g., 2,000 nodes), resource optimization remains a priority. While spreading these services out is essential for tolerance, bin packing should still be considered for the remaining services to increase the utilization of all nodes.&lt;/p&gt;

&lt;p&gt;Kubernetes can manage this through topology spread configurations such as &lt;a href="https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/"&gt;PodTopologySpreadArgs&lt;/a&gt; if specific resources from nodes are used. Cluster admins and cloud providers should ensure nodes are provisioned accordingly to balance the spread-out services and the bin-packed services.&lt;/p&gt;

&lt;p&gt;By understanding and applying these examples in your Kubernetes environment, you can leverage bin packing to optimize resource utilization and improve the overall efficiency of your cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost Efficiency Benefits of Bin Packing in Kubernetes
&lt;/h2&gt;

&lt;p&gt;By efficiently allocating resources within a cluster and minimizing the number of nodes necessary to support workloads, bin packing can help reduce your infrastructure costs. This is achieved by consolidating multiple containers onto fewer nodes, which reduces the need for additional hardware or cloud-based resources. As a result, organizations can save on hardware, energy, and maintenance.&lt;/p&gt;

&lt;p&gt;In cloud environments, where infrastructure costs are a significant portion of IT expenses, the cost savings from bin packing can be particularly impactful. Cloud providers typically charge customers based on the number and size of nodes used, so optimizing resource utilization through bin packing can directly translate to reduced cloud infrastructure bills.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices for Bin Packing in Kubernetes
&lt;/h2&gt;

&lt;p&gt;To fully harness the benefits of bin packing in Kubernetes, it's essential to follow best practices to ensure optimal resource utilization while preventing performance problems. We highlight three below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Careful Planning and Testing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before implementing bin packing in your Kubernetes environment, it's crucial to carefully plan and test the placement of containers within nodes. This may involve analyzing the resource requirements of your workloads, determining the appropriate level of density, and testing the performance and stability of your cluster under various scenarios. Additionally, setting hard limits for memory is essential, as memory is a non-compressible resource and should be allocated carefully to avoid affecting surrounding applications. It is also important to account for potential memory leaks, ensuring that one leak does not cause chaos within the entire system.&lt;/p&gt;

&lt;p&gt;By taking the time to plan and test, you can avoid potential pitfalls associated with bin packing, such as resource contention and performance degradation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Right Sizing Nodes and Containers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Properly sizing nodes and containers is a key aspect of optimizing resource utilization in your Kubernetes environment. To achieve this, first assess the resource requirements of your applications, taking into account CPU, memory, and storage demands. This information helps in determining the most suitable node sizes and container resource limits to minimize waste and maximize efficiency. It is crucial to size nodes and containers appropriately for the workload because if your containers are too large and take up a significant proportion of the node, then you won't be able to fit additional containers onto the node. If you're running a very large container that takes up 75% of every node, for example, it will essentially force 25% waste regardless of how many bin packing rules were set. The resources allocated to a container and the resources a machine offers are critical factors to consider when optimizing your Kubernetes environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring and Adjusting Over Time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Continuous monitoring and adjustment are essential for maintaining optimal resource utilization in your Kubernetes clusters. As workloads and requirements evolve, you may need to reassess your bin packing strategy to ensure it remains effective.&lt;/p&gt;

&lt;p&gt;Regular monitoring can help you identify issues early on, such as resource contention or underutilized nodes, allowing you to make adjustments before a problem escalates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Utilizing Kubernetes Features for Bin Packing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Resource quotas allow you to limit the amount of resources a namespace can consume, ensuring that no single workload monopolizes the available resources in your cluster.&lt;br&gt;
Resource requests and limits for your pods, already noted above, let you guide the Kubernetes scheduler to place containers on nodes with the appropriate amount of resources. This helps ensure workloads are allocated efficiently and resource contention is minimized.&lt;/p&gt;

&lt;p&gt;One more aspect to consider is the environmental impact of your infrastructure. By optimizing resource utilization through bin packing, you can potentially reduce your organization's carbon footprint. Running fewer nodes means consuming less energy and generating less heat, which can contribute to lower greenhouse gas emissions and a smaller environmental impact. This raises an important question: How can businesses balance their goals for cost efficiency and performance with their social responsibility to reduce their environmental footprint?&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Bin packing in Kubernetes plays a crucial role in optimizing resource utilization and reducing infrastructure costs. But it's also important to achieve the right balance between efficiency and performance when optimizing Kubernetes resources.&lt;/p&gt;

&lt;p&gt;By strategically allocating resources within a cluster, organizations can minimize the number of nodes required to run workloads, ultimately resulting in lower spend and more efficient infrastructure management.&lt;/p&gt;

&lt;p&gt;However, as discussed, there are some performance-related challenges and trade-offs associated with bin packing, as well as best practices for effectively employing bin packing in your Kubernetes environment. By understanding and leveraging these techniques, you can maximize resource utilization in your cluster, save on infrastructure costs, and improve overall efficiency.&lt;/p&gt;

&lt;p&gt;This articles was originally published on &lt;a href="https://www.infoq.com/articles/kubernetes-bin-packing/"&gt;InfoQ&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Automatically Resize Amazon EBS Capacity with Zesty Disk for Cost Efficiency and Consistent Performance</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Mon, 27 Nov 2023 10:03:18 +0000</pubDate>
      <link>https://dev.to/zesty_tech/automatically-resize-amazon-ebs-capacity-with-zesty-disk-for-cost-efficiency-and-consistent-performance-377e</link>
      <guid>https://dev.to/zesty_tech/automatically-resize-amazon-ebs-capacity-with-zesty-disk-for-cost-efficiency-and-consistent-performance-377e</guid>
      <description>&lt;p&gt;&lt;em&gt;by Aviram Levy, Adinah Brown, Aaron Curtis, Anudeep Burugula, and Siva Sadhu | on 20 NOV 2023&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Cloud computing has helped organizations adapt their infrastructure to changing business needs. One of the key drivers for companies moving to the cloud is the ability to scale up and down infrastructure capacity as needed.&lt;/p&gt;

&lt;p&gt;By dynamically adjusting infrastructure capacity based on usage fluctuations, organizations gain both operational and cost benefits. Aligning resources with actual needs reduces the operational load required to ensure there’s sufficient capacity and mitigates the risk of application failure.&lt;/p&gt;

&lt;p&gt;On the flip side, there are improvements to cost efficiency. Businesses no longer need to provision resources in excess of what they need. Instead, they pay only for the resources they require, minimizing waste and enhancing financial efficiency.&lt;/p&gt;

&lt;p&gt;In this post, we will share how &lt;a href="https://zesty.co/zesty-disk/"&gt;Zesty Disk&lt;/a&gt; helps achieve greater cost efficiency and consistent performance when managing Amazon Elastic Block Store (Amazon EBS) volumes. The cloud-native solution optimizes storage at run time without adding any complexity or being exposed to any data on the disk.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://zesty.co/"&gt;Zesty&lt;/a&gt; was built with the vision of helping Amazon Web Services (AWS) customers make their cloud infrastructure more dynamic. Zesty is an &lt;a href="https://partners.amazonaws.com/partners/0010L00001w0gJyQAI/Zesty"&gt;AWS Specialization Partner&lt;/a&gt; and &lt;a href="https://aws.amazon.com/marketplace/seller-profile?id=87c6edf2-bb6d-404e-9fa5-38143934f082"&gt;AWS Marketplace Seller&lt;/a&gt; with the Cloud Operations Competency. Zesty helps organizations to be more adaptable to changing business needs by making their cloud infrastructure more dynamic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modifying EBS Volumes Using Elastic Volumes
&lt;/h2&gt;

&lt;p&gt;Amazon EBS Elastic Volumes allow you to increase volume size, change volume type, or adjust the performance of your EBS volumes. If your instance supports Elastic Volumes, the changes can be done without detaching the volume or restarting the instance. You can continue to use your application while the change takes effect.&lt;/p&gt;

&lt;p&gt;Before modifying a volume that contains valuable data, it’s a best practice to &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html"&gt;create a snapshot&lt;/a&gt; of the volume in case you need to roll back your changes. Once you have the snapshot of the volume, you can &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html"&gt;request the volume modification&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If the size of the volume was modified, you must &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html"&gt;extend the volume’s file system&lt;/a&gt; to take advantage of the increased storage capacity.&lt;/p&gt;

&lt;p&gt;There are a few approaches to automate the volume resizing process using AWS Step Functions and AWS Systems Manager which require engineering effort to set up the cloud infrastructure, catalog the existing EBS drives, use monitoring agents on Amazon Elastic Compute Cloud (Amazon EC2) instances, and so on. This generates noticeable overhead on implementation and maintenance.&lt;/p&gt;

&lt;p&gt;Another key consideration is that you can only increase volume size. You can’t decrease the EBS volume size, but if a smaller volume is preferred you can create a smaller volume and then migrate your data to it using an application-level tool such as rsync.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Zesty Disk Delivers Greater Cost Efficiency
&lt;/h2&gt;

&lt;p&gt;With its unique proprietary algorithm, Zesty Disk makes it possible to automatically expand and shrink block storage without any risk to application stability. The block storage autoscaler shrinks and expands volumes at run time, effectively right-sizing storage, with value to be gained for application stability and cost reduction.&lt;/p&gt;

&lt;p&gt;The solution’s artificial intelligence (AI) algorithm responds to changing application demand, ensuring users pay only for the storage they need.&lt;/p&gt;

&lt;p&gt;Let’s dive deeper into some of the benefits Zesty Disk delivers for AWS customers using Amazon EBS.&lt;/p&gt;

&lt;p&gt;Zesty Disk brings about cost optimization by dynamically adjusting storage capacity based on data requirements. By continuously monitoring usage metrics and instance metadata, Zesty Disk effectively determines when to shrink or expand storage sizes to match the data volume. This flexible approach ensures resources are allocated optimally, minimizing unnecessary costs.&lt;/p&gt;

&lt;p&gt;When there is less data, Zesty Disk automatically shrinks the storage capacity to avoid overprovisioning. By decoupling large filesystem volumes into smaller volumes, it can remove unused or underutilized storage, freeing up resources and reducing costs. This proactive approach to right-sizing storage ensures efficient resource allocation without compromising application performance.&lt;/p&gt;

&lt;p&gt;Conversely, when there’s an increase in data Zesty Disk seamlessly expands the storage capacity. It can add smaller disks to accommodate the growing data volume, and this elasticity allows businesses to scale their storage infrastructure on-demand, avoiding overprovisioning and unnecessary expenses.&lt;/p&gt;

&lt;p&gt;By dynamically adjusting storage capacity based on data fluctuations, Zesty Disk delivers cost optimization by ensuring businesses only pay for the storage they require and use, saving valuable resources and enhancing overall financial performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Eliminating Downtime
&lt;/h2&gt;

&lt;p&gt;By decoupling large filesystem volumes into smaller volumes, Zesty Disk can make real-time adjustments to support the application’s availability and ensure it doesn’t run into downtime due to insufficient disk space.&lt;/p&gt;

&lt;p&gt;When a change in storage capacity is required, Zesty Disk leverages autoscaling technology to dynamically resize the storage volume. The ML algorithm analyzes usage metrics and instance metadata and accurately predicts the storage needs, adjusting the volume accordingly. This ensures the application has the optimal storage capacity to perform efficiently.&lt;/p&gt;

&lt;p&gt;The process of adjusting the storage volume is executed smoothly. Zesty Disk serializes the filesystems on the disk, replacing a large volume with multiple smaller volumes. If additional storage is needed, Zesty Disk can add smaller disks seamlessly. On the other hand, when there is a need to reduce capacity, Zesty Disk can evict a disk by redistributing its data to other volumes before removing it. This is a process of redistributing data and adjusting the storage size.&lt;/p&gt;

&lt;p&gt;By dynamically adjusting the storage volume without causing downtime, Zesty Disk provides uninterrupted application availability. Businesses can avoid costly disruptions and maintain continuous operations while efficiently managing their storage resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improving IOPS Performance
&lt;/h2&gt;

&lt;p&gt;The decoupling of the filesystem into multiple smaller volumes, each with its own dedicated allocation of input/output operations per second (IOPS), entails a significant boost in performance, speed, and enhanced user experience.&lt;/p&gt;

&lt;p&gt;Traditionally, a single large volume would have a limited number of IOPS allocated to it, but Zesty Disk breaks this limitation by splitting the volume into multiple smaller volumes. With each smaller volume having its own allocation of IOPS, the total IOPS capacity increases proportionately. This means the application can benefit from a higher level of concurrent I/O operations, resulting in improved performance and responsiveness.&lt;/p&gt;

&lt;p&gt;Moreover, this approach allows Zesty Disk to optimize throughput performance. By distributing the workload across multiple smaller volumes, the overall throughput capacity is increased, enabling faster data transfer rates and more efficient data processing.&lt;/p&gt;

&lt;p&gt;By decoupling large filesystem volumes into multiple smaller volumes with dedicated IOPS allocations, Zesty Disk harnesses the full potential of the underlying storage infrastructure, delivering improvements in both IOPS and throughput performance. This translates to a superior user experience, ensuring applications can operate at peak performance levels while efficiently utilizing available resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zesty Disk Under the Hood
&lt;/h2&gt;

&lt;p&gt;The solution works by creating a virtual disk composed of several small storage volumes. It utilizes native AWS block storage devices, allowing users to maintain their existing tools, procedures, and service level agreements (SLAs). Users retain ownership and exclusive access to their data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WO-lIgK1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nu8mcdysz2cz2n744hnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WO-lIgK1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nu8mcdysz2cz2n744hnn.png" alt="Image description" width="800" height="676"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 1 – Deployment architecture of Zesty Disk&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Step-by-step instructions to install Zesty disk on an Amazon EC2 instance are available on the Zesty website.&lt;/p&gt;

&lt;p&gt;Zesty Disk continuously monitors usage metrics, including capacity, IOPS, and read/write throughput, as well as instance and disk metadata.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fjj-7fk6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnrcnl54qz8nvht6dmlm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fjj-7fk6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnrcnl54qz8nvht6dmlm.png" alt="Image description" width="800" height="391"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 2 – Dashboard showing changing disk capacity and average read/write IOPS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This data is securely sent to Zesty’s backend for processing. An AI model analyzes the metrics to generate a behavioral profile of the instance volume, predicting usage patterns and fluctuations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--91J3hhQT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx370av6rvkjnvqy9qmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--91J3hhQT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx370av6rvkjnvqy9qmg.png" alt="Image description" width="800" height="408"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 3 – Zesty Disk’s operation in the client’s cloud environment&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When a capacity change is required, Zesty’s backend issues API commands to the cloud provider, triggering the appropriate action. An update request is then sent to the Zesty Disk handler on the instance to adjust the capacity accordingly.&lt;/p&gt;

&lt;p&gt;The filesystems on the disk are serialized, replacing a large volume with multiple smaller volumes. Disk eviction can occur by transferring data from a smaller volume to other disks before removing it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5PYvkqZ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rvfzlhhpd9lpiutt9y6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5PYvkqZ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rvfzlhhpd9lpiutt9y6.png" alt="Image description" width="800" height="351"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 4 – Defragmentation of the disk enables increase/ decrease in filesystem size&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Customer Success Story: Securonix
&lt;/h2&gt;

&lt;p&gt;As a security, information, and event management (SIEM) solution that detects advanced threats using innovative machine learning algorithms, Securonix collects massive amounts of data in real-time.&lt;/p&gt;

&lt;p&gt;The high volume of data entailed it had to frequently allocate large terabytes of disk storage per Amazon EC2 instance. However, once all of the available capacity was consumed by the ingested data produced by its analytics engine, Securonix was paying for block storage capacity it wasn’t using in the time this took to fill up.&lt;/p&gt;

&lt;p&gt;Securonix uses Amazon Elastic MapReduce (Amazon EMR) to run HBase (Hadoop database) and Spark, and used Zesty Disk (ZD) as a seamless service to ensure storage persistence when there is high data usage, creating greater demand on the disk required for the database.&lt;/p&gt;

&lt;p&gt;A custom Amazon Machine Image (AMI) was developed that uses the ZD filesystem (Amazon Linux 2 with ZD). The fragmenting into small storage volumes is what enables the elasticity for the volume to grow as data is ingested, and to shrink as data is removed when a snapshot is taken. In this process, all native tools, procedures, and SLAs remain unchanged, and Securonix remained the owner of its data and the only ones that have control over it.&lt;/p&gt;

&lt;p&gt;After running its EMR clusters with EBS volumes fully managed by Zesty Disk, Securonix was pleased with the seamless service availability even in the case of large data ingestion peaks.&lt;/p&gt;

&lt;p&gt;Operationally, Zesty Disk avoids the hassle of reallocating storage across instances and eliminates on-call developer tasks related to maintaining EBS. With a net capacity utilization of 40% on its prior provisioned storage and shrinking provisioned capacity, Securonix saves 66% off its earlier EBS cost.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Prior to implementing Zesty Disk, we were seeing an average storage utilization of less than 35%. This was difficult to optimize due to the potential to run out of storage and cause a production outage,” says Derrick Harcey, Chief Architect at Securonix. “Once we implemented Zesty Disk, we are able to maintain more than 75% EBS storage utilization to significantly reduce storage costs. In addition to reducing storage costs, the performance of our EBS volumes has increased significantly due to the inherent parallelism introduced with virtual disks with multiple underlying EBS volumes."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Zesty Disk offers a unique solution to maximize the value derived from Amazon EBS. With the ability to decouple large filesystem volumes into smaller volumes, organizations are able to experience improved performance and cost efficiency, achieving more with their existing storage resources.&lt;/p&gt;

&lt;p&gt;The solution’s auto-scaling technology eliminates the need for manual adjustments, streamlining operations and reducing the cognitive load for developers. Overall, Zesty Disk provides a powerful tool for organizations to enhance cost storage infrastructure, ensure cost-effectiveness and operational efficiency, and increase value from EBS investments.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Spearheading this initiative was made easy by the amazing team that we worked with at Securonix,” says Uri Naiman, Sales Engineering Team Lead at Zesty. “We were able to show significant cost savings, whilst ensuring there was no negative impact to either performance or to their application."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn more about Zesty Disk and request a demo. You can also explore Zesty products in AWS Marketplace.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally published on &lt;a href="https://aws.amazon.com/blogs/apn/automatically-resize-amazon-ebs-capacity-with-zesty-disk-for-cost-efficiency-and-consistent-performance/"&gt;AWS Partner Network (APN) Blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>performance</category>
    </item>
    <item>
      <title>How to Shrink EBS Volumes</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Sun, 26 Nov 2023 11:52:28 +0000</pubDate>
      <link>https://dev.to/zesty_tech/how-to-shrink-ebs-volumes-27p0</link>
      <guid>https://dev.to/zesty_tech/how-to-shrink-ebs-volumes-27p0</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally published on &lt;a href="https://www.thestack.technology/how-to-shrink-ebs-volumes/"&gt;The Stack&lt;br&gt;
&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;"Unfortunately, the size of an existing EBS volume cannot be decreased. Instead, it is possible to create a smaller volume and move the data using tools such as rsync, at the cost of pausing the system’s write operations during the migration..."&lt;/p&gt;

&lt;p&gt;Developers frequently need to run applications on EC2 instances, a common approach with legacy or functionally complex apps in particular. The instances use Amazon EBS (Elastic Block Storage) as their permanent file systems. Since your applications will fail if your disks become full, some overprovisioning of EBS space is necessary.&lt;/p&gt;

&lt;p&gt;It often happens that an EBS volume needs to be adjusted. For example, I once had to add a 4 TB volume per production instance to collect advanced logs about alleged bugs, writes Uri Naiman, Sales Engineering Team Lead at Zesty. But after I finished debugging, I no longer needed the volumes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://zesty.co/commitment-manager/"&gt;Running out of disk space is a serious risk&lt;/a&gt; that must be mitigated in order to prevent downtime and data loss. Determining the optimal size of the EBS volume can be extremely difficult. In some cases, I’ve needed to expand an EBS volume due to new application features requiring more disk space for debugging or for dealing with higher traffic, which can create more logs and temporal data than was initially anticipated.&lt;/p&gt;

&lt;p&gt;Another common scenario is your application or database storage requiring more space over time. The safe bet is to provision way in excess of what you’re actually going to use to cover for all possible causes of data peaks, however, this will increase your cloud bill substantially.&lt;/p&gt;

&lt;p&gt;When a software product is being developed, the focus is on delivery, while the exact requirements and costs are still unknown. In almost every company I’ve ever worked at, once the product was operational, we discovered large expenses in our cloud bill. This was often due to our EBS volume cost.&lt;/p&gt;

&lt;p&gt;In addition to the hefty cloud bill, developers are often poised to dedicate valuable hours of the day to managing volumes manually. But this manual and repetitive task is a perfect opportunity for AI and machine learning to take over.&lt;/p&gt;

&lt;p&gt;In this article, I’ll demonstrate how to shrink an EBS volume in order to lower your cloud bill. First, I’ll explain how to do this manually, a far more labor-intensive task than what may have been expected. Then, I’ll explain how this can be orchestrated automatically without downtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  EBS Pricing Considerations
&lt;/h2&gt;

&lt;p&gt;The cost of a single terabyte general-purpose disk (gp3) runs at least $80 per month. That means a dozen instances with such storage would set you back $1,000 per month. That’s not even taking into account any backups you’d need to make (priced at roughly 50% of gp3 storage cost). So this scenario is hardly pragmatic.&lt;/p&gt;

&lt;p&gt;In order to save costs and be able to adjust continuously based on demand, you need to provide sufficient EBS storage without reserving too much. While in theory you could handle EBS sizes for just a small number of instances manually, the process is still tedious, requiring multiple steps. And once your system grows beyond a few instances, this simply becomes unmanageable without automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expanding a Volume
&lt;/h2&gt;

&lt;p&gt;Expanding an EBS volume in AWS involves submitting a request, where you can set the new size and tweak the performance parameters. But this approach has its limitations. For one, it requires a cooldown period of several hours between consequent modifications. While a reboot isn’t usually necessary, there have been times where I’ve needed to restart the instance to apply the changes or for the performance adjustments to take effect. There are also a few cases where changes to a desired volume configuration may not even be possible.&lt;/p&gt;

&lt;p&gt;While the expansion of the volume can be automated, the customer must implement the required automation themselves, which can incur additional development and maintenance costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shrinking a Volume
&lt;/h2&gt;

&lt;p&gt;When peaks in demand subsist, shrinking EBS volumes to fit the reduced app demand would enable greater cost efficiency. Unfortunately, the size of an existing EBS volume cannot be decreased. Instead, it is possible to create a smaller volume and move the data using tools such as rsync, at the cost of pausing the system’s write operations during the migration.&lt;/p&gt;

&lt;p&gt;Let’s take a look at how it’s done. We’ll consider an instance with two EBS volumes: one (root) for the system and another mounted to /data, for the application data:&lt;/p&gt;

&lt;p&gt;$ df -h&lt;/p&gt;

&lt;p&gt;Filesystem      Size  Used Avail Use% Mounted on&lt;/p&gt;

&lt;p&gt;/dev/xvda1       16G  1.6G   15G  10% /&lt;/p&gt;

&lt;p&gt;…&lt;/p&gt;

&lt;p&gt;/dev/xvdb       7.8G   92K  7.4G   1% /data&lt;/p&gt;

&lt;p&gt;The respective EBS volumes can be viewed using an AWS CLI command aws ec2 describe-volumes, which prints out instance and volume IDs. Suppose we determined that /data size was too big and wanted to replace it with a smaller volume.&lt;/p&gt;

&lt;p&gt;Using AWS CLI, we can create a new small volume of 5 GB:&lt;/p&gt;

&lt;p&gt;aws ec2 create-volume --availability-zone eu-west-1a --size 5 --volume-type gp3&lt;/p&gt;

&lt;p&gt;The volume should be attached to the instance, after which it becomes visible in the system as /dev/xvdc:&lt;/p&gt;

&lt;p&gt;aws ec2 attach-volume --volume-id "" --instance-id "" --device "/dev/xvdc" &lt;/p&gt;

&lt;p&gt;Next, in order to continue, we need to log in to the instance and perform the following actions (Here, we’re using commands that work on Amazon Linux):&lt;/p&gt;

&lt;p&gt;Create directory /newdata and mount the block device that corresponds to  :&lt;/p&gt;

&lt;p&gt;sudo mount /dev/xvdc /newdata&lt;br&gt;
Create a filesystem on the new block device, for instance, of type ext3:&lt;/p&gt;

&lt;p&gt;sudo mkfs -t ext3 /dev/xvdc&lt;br&gt;
Update /etc/fstab so new device is reattached on reboot (Note that depending on your particular setup and filesystem of choice, this line might look different):&lt;br&gt;
echo "UUID=$(lsblk -no UUID /dev/xvdc) /data ext3 defaults 0 0" | sudo tee -a /etc/fstab&lt;/p&gt;

&lt;p&gt;Now that both /data and /newdata are mounted, we can migrate the content using rsync.&lt;/p&gt;

&lt;p&gt;sudo rsync -aHAXxSP /data /newdata&lt;/p&gt;

&lt;p&gt;By using these flags and specifying the appropriate source and destination paths, the rsync command will synchronize the files and directories between the source and destination—preserving attributes, hard links, ACLs, and EAs.&lt;br&gt;
We must ensure that writes to /data don’t happen anymore to ensure consistency. To achieve that, we’ll most likely have to shut down our application during migration, leading to system downtime.&lt;/p&gt;

&lt;p&gt;Next, unmount /data and erase its line in /etc/fstab. We also need to remount the /newdata filesystem as /data, adjust the /etc/fstab accordingly, reboot the instance to verify the correct mount point, and conduct any necessary checks.&lt;br&gt;
$ df -h&lt;/p&gt;

&lt;p&gt;Filesystem      Size  Used Avail Use% Mounted on&lt;/p&gt;

&lt;p&gt;/dev/xvda1       16G  1.6G   15G  10% /&lt;/p&gt;

&lt;p&gt;…&lt;/p&gt;

&lt;p&gt;/dev/xvdc       4.9G  140K  4.6G   1% /data&lt;/p&gt;

&lt;p&gt;Migration is now complete, and we can destroy the decommissioned larger EBS volume:&lt;/p&gt;

&lt;p&gt;aws ec2 detach-volume --volume-id &lt;/p&gt;

&lt;p&gt;aws ec2 delete-volume --volume-id &lt;/p&gt;

&lt;p&gt;As I’ve demonstrated, shrinking poses many challenges. You need to deal with the AWS infrastructure and reliably migrate the data between volumes. Most likely, the application should be terminated or brought into a read-only mode to avoid inconsistent migration, which often leads to downtime. If there are any human or coding errors, there is a risk that data may be corrupted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automatically Scale EBS Volumes to Demand with Machine Learning
&lt;/h2&gt;

&lt;p&gt;The ability to shrink EBS volumes can greatly reduce overspending by utilizing machine learning based technology to automatically resize volumes in response to demand. This minimizes costs and eliminates the need to continuously monitor or tweak the capacity as demand fluctuates.&lt;/p&gt;

&lt;p&gt;Applying automated solutions towards managing disk volumes has the benefit of working 24/7 so they can instantly respond to unexpected changes in demand, they save significantly more than manual management, and they don’t require any downtime when decreasing storage size. Plus, they provide the intangible value of alleviating the burden and stress of having insufficient capacity should a data peak suddenly occur.&lt;/p&gt;

&lt;p&gt;Not only can intelligent automated solutions free up valuable time for cloud operations teams, it also eliminates human error by making data-driven decisions based on disk utilization metrics, ensuring precise cost optimization.&lt;/p&gt;

&lt;p&gt;The FinOps industry has certainly embraced automated solutions to save time and money on compute but storage seems to largely get ignored. Companies can of course continue to have their DevOps teams manually shrink EBS volumes. Why would you preference that over automated management, that more consistently scales provisioned storage to used consumption, ensuring both consistently sufficient capacity and excellent storage cost savings?&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>database</category>
    </item>
    <item>
      <title>Understanding and Leveraging Kubernetes Controllers</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Fri, 24 Nov 2023 08:48:18 +0000</pubDate>
      <link>https://dev.to/zesty_tech/understanding-and-leveraging-kubernetes-controllers-4ojf</link>
      <guid>https://dev.to/zesty_tech/understanding-and-leveraging-kubernetes-controllers-4ojf</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally published on &lt;a href="https://cloudnativenow.com/features/understanding-and-leveraging-kubernetes-controllers/"&gt;Cloud Native Now&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As more businesses shift toward microservices, Kubernetes is turning into a go-to tool for handling the nitty-gritty of today’s IT world, and its API plays a pivotal role. Think of the K8s API as the control hub, making the &lt;a href="https://zesty.co/"&gt;management of the Kubernetes cluster&lt;/a&gt; a breeze and letting users spell out how they want their apps and infrastructure to look and act.&lt;/p&gt;

&lt;p&gt;Kubernetes controllers are the unsung heroes, constantly working to ensure the system’s actual state matches the user’s needs. Here, the operator pattern is a real game changer, showing how flexible and user-focused Kubernetes can be.&lt;/p&gt;

&lt;p&gt;The operator pattern was created to meet the varied needs of businesses and devs and enables Kubernetes to do even more, including managing custom resources it wasn’t originally built for. This means Kubernetes can be customized to handle all sorts of systems, proving it’s ready to adapt to whatever the tech world throws at it. Kubernetes really stands out when you consider the cool features and extensions the operator pattern brings to the table, offering solid answers to today’s tech hurdles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes-Native Controllers
&lt;/h2&gt;

&lt;p&gt;By operating on the principle of desired state management, Kubernetes allows users to dictate their system’s configuration through a centralized control plane, which serves as the decision-making and monitoring hub. At the heart of this control plane are the Kubernetes-native controllers, purpose-built to manage specific resources within the ecosystem. These controllers continuously monitor their respective resources and ensure the system’s current state aligns seamlessly with the user-defined desired state; controllers automatically make necessary adjustments to maintain this balance.&lt;/p&gt;

&lt;p&gt;For instance, consider the deployment controller. When you deploy an application in Kubernetes using a Deployment, this controller jumps into action. It ensures that the specified number of replicas of your application is maintained. If a pod crashes or becomes unresponsive, the deployment controller will recognize the discrepancy and initiate the creation of a new pod to maintain the desired state.&lt;/p&gt;

&lt;p&gt;Similarly, the ReplicaSet controller maintains the correct number of pod replicas. It’s closely related to the deployment controller but operates at a slightly lower level, focusing specifically on pod replicas without the additional features that deployments offer.&lt;/p&gt;

&lt;p&gt;These are just two examples, but Kubernetes boasts a plethora of native controllers, each tailored for specific tasks, like managing services, volumes or network policies. Together, they contribute to Kubernetes’ reliability and resilience, ensuring that your applications and infrastructure run smoothly and consistently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Controller Use Case: Tracking New Volumes
&lt;/h2&gt;

&lt;p&gt;In my journey through the dynamic world of Kubernetes, I’ve found myself in situations where the built-in controllers couldn’t meet specific needs that cropped up. That’s when I realized the true power of custom controllers.&lt;/p&gt;

&lt;p&gt;I worked in a large-scale organization where we were constantly deploying and scaling storage volumes. It became evident that we needed an efficient system to keep track of these deployments. I imagined how great it would be if I could receive a Slack notification every time a new storage volume was deployed. In addition, the volumes would be annotated automatically for monitoring systems without human intervention. While Kubernetes doesn’t offer these features natively, I figured out that a custom controller could be the perfect solution to bridge this gap.&lt;/p&gt;

&lt;p&gt;So, I mapped out a workflow for the controller to handle this scenario, which looked something like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new storage volume gets deployed in the Kubernetes cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The custom controller, which I designed to keep an eye on storage volumes, spots this new deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The controller reacts to this by triggering a predefined action—in this case, shooting off a notification to a Slack channel and annotating volumes for monitoring.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;My team received the Slack notification, giving me a heads-up about the new volume deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Armed with this info, I could quickly gauge whether the new storage was vital for a particular application or if we needed to make some tweaks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This hands-on experience highlighted the versatility and adaptability of custom controllers. I was able to tailor Kubernetes to my specific needs, ensuring seamless integration with the other tools and platforms I relied on while maintaining the system in its desired state. It turned out to be a practical solution and helped to streamline operations and keep everything running smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes-Native Way: kubebuilder
&lt;/h2&gt;

&lt;p&gt;Kubernetes boasts a rich ecosystem that not only allows for the creation of custom controllers but also offers tools to facilitate this process. A standout tool in this realm is kubebuilder, a scaffolding framework designed to construct Kubernetes APIs and controllers. This tool greatly simplifies the task of integrating custom resources and logic into Kubernetes.&lt;/p&gt;

&lt;p&gt;The preference for kubebuilder over custom scripts stems from several of its advantages: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It provides a structured project layout, streamlining the development and maintenance of controllers and custom resources. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It autogenerates much of the repetitive code essential for setting up controllers and APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It integrates seamlessly with Kustomize for configuration customization and is backed by thorough documentation to guide developers through its functionalities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Walkthrough: Creating a Controller With kubebuilder
&lt;/h2&gt;

&lt;p&gt;To get going on creating a controller with Kubebuiler, I highly recommend The Kubebuilder Book. It provides a comprehensive walkthrough of creating a container, covering all the steps and components. Even for the relative experts out there, this guide is worth looking into to further sharpen your skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of Controllers
&lt;/h2&gt;

&lt;p&gt;Kubernetes controllers, both inherent and custom-made, serve as the foundational pillars of the Kubernetes ecosystem. Acting as silent custodians, they ensure the cluster’s current state consistently mirrors the user’s desired specifications. These controllers offer a multitude of benefits:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High availability:&lt;/strong&gt; Controllers are integral to Kubernetes’ promise of high availability. For instance, in the context of tracking newly created volumes, having a controller that notifies the team immediately ensures that any issues can be addressed promptly, maintaining the high availability of the volumes. This self-recovery feature ensures applications remain robust against failures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Versatility:&lt;/strong&gt; Controllers in Kubernetes are designed to cater to diverse needs. Leveraging them in tracking volume creations showcases their versatility in adapting to different operational needs, including batch jobs, stateful services or daemon processes. This allows Kubernetes to manage varied workloads effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Appropriate permissions:&lt;/strong&gt; By prioritizing security, controllers operate on a least-privilege principle. They possess only the essential permissions needed for their tasks, reducing potential security threats and limiting the impact of any compromised component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource optimization:&lt;/strong&gt; Beyond state maintenance, controllers emphasize efficiency. In the scenario of tracking volumes, it aids in resource optimization by providing real-time updates, facilitating immediate actions to optimize resources based on the current state and guaranteeing cost efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extensibility:&lt;/strong&gt; Kubernetes’ flexibility is evident in its support for custom controllers, allowing users to address unique needs beyond the capabilities of native controllers. This adaptability ensures Kubernetes stays relevant to changing business needs. For example, in the case of tracking volumes, it has extended its functionality to integrate seamlessly with tools like Slack, enhancing operational efficiency and responsiveness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Controllers aren’t just a component of Kubernetes; they’re its lifeblood, ensuring that applications remain available, resilient and efficient. They are essentially the Ops engineers’ method of introducing automation to K8s in an elegant and resilient way and extending their capabilities. In most scenarios, controllers prove to be the optimal way to interact with clusters, outshining scripts and manual interventions. Controllers’ automated, continuous monitoring and action loops mean the system can stay in its desired state without constant human oversight.&lt;/p&gt;

&lt;p&gt;It’s also worth delving deeper into how controllers aid in extending the system. The term “operator” defines a set of controllers and custom resource definitions (CRDs), which are—in essence—custom resources. I’ve touched upon this concept briefly in this article. Still, it’s fundamental to understand that operators allow for creating custom, application-specific controllers, thereby enhancing the extensibility of Kubernetes.&lt;/p&gt;

&lt;p&gt;So, as you navigate your Kubernetes journey, remember the pivotal role of controllers and consider crafting your own. With the extensibility features of Kubernetes—especially through the use of operators—you stand to gain even more from the cloud-native infrastructure and ecosystem.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>beginners</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Master Databases to Get More from Your Kubernetes Clusters</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Thu, 13 Apr 2023 21:35:43 +0000</pubDate>
      <link>https://dev.to/zesty_tech/how-to-master-databases-to-get-more-from-your-kubernetes-clusters-31p4</link>
      <guid>https://dev.to/zesty_tech/how-to-master-databases-to-get-more-from-your-kubernetes-clusters-31p4</guid>
      <description>&lt;p&gt;Kubernetes is the de facto container orchestration system to run scalable and reliable microservices. Due to its modern, cloud-native approach, Kubernetes is one of the key technologies that brought about significant improvements in software development. Because of this, more and more applications have migrated to Kubernetes, including but not limited to databases. &lt;/p&gt;

&lt;p&gt;In a traditional database, you store, manage, and serve the data required for your applications, customers, and analyses. Users, frontends, and other applications can connect to the database to query data. With the cloud-native approach, applications have become smaller and more numerous, leading to changes in how databases are used. &lt;/p&gt;

&lt;p&gt;This blog will focus on running databases in Kubernetes and discuss the related advantages, limitations, and best practices. &lt;/p&gt;

&lt;h2&gt;
  
  
  Running Databases on Kubernetes
&lt;/h2&gt;

&lt;p&gt;Kubernetes and containers were initially intended for stateless applications where no data is generated and saved for the future. With the technological development in data center infrastructure and storage, Kubernetes and containers are now also used for stateful applications such as message queues and databases. &lt;/p&gt;

&lt;p&gt;There are two mainstream options for running databases on Kubernetes: StatefulSets and sidecar containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  StatefulSets
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/"&gt;StatefulSets&lt;/a&gt; are the native Kubernetes resources to manage stateful applications. They manage &lt;a href="https://kubernetes.io/docs/concepts/workloads/pods/"&gt;pods&lt;/a&gt; by assigning persistent identities for rescheduling and storage assignments, ensuring that pods always get the same unique ID and volume attachment when scheduled to another node. This sticky characteristic makes it possible to run databases on Kubernetes reliably and with the ability to scale.&lt;/p&gt;

&lt;p&gt;Still, although Kubernetes does its best to run databases, deploying and scaling them is not straightforward. When you check the additional resources to deploy a &lt;a href="https://github.com/bitnami/charts/tree/main/bitnami/mysql/templates"&gt;MySQL Helm chart&lt;/a&gt;, you will see configmaps, services, roles, role bindings, secrets, network policies, and service accounts. Management of these Kubernetes resources with updates, backups, and restores can quickly become overwhelming. &lt;/p&gt;

&lt;p&gt;There are three vital resources for deploying databases on Kubernetes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/configuration/configmap/"&gt;ConfigMaps&lt;/a&gt; store the application configuration; you can use them as files, environment variables, or command-line arguments in pods. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/configuration/secret/"&gt;Secrets&lt;/a&gt; are the Kubernetes resources for storing sensitive data like passwords, tokens, or keys. These do have one critical drawback: They are stored unencrypted in the underlying data store (etc). Check out this &lt;a href="https://kubernetes.io/docs/concepts/configuration/secret/#information-security-for-secrets"&gt;link&lt;/a&gt; to learn how to secure secrets in Kubernetes installations, such as using an external secrets manager. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/services-networking/service/"&gt;Kubernetes Service&lt;/a&gt; resources allow other applications running in the Kubernetes cluster to connect and use the database instances. &lt;/p&gt;

&lt;p&gt;Luckily, you do not need to create all these resources by yourself. There are widely used Helm charts to deploy popular database installations—including MySQL, PostgreSQL, or MariaDB—as StatefulSets with a wide range of configuration options. &lt;/p&gt;

&lt;h3&gt;
  
  
  Sidecar Containers
&lt;/h3&gt;

&lt;p&gt;Here, Kubernetes pods encapsulate multiple containers and run them together as a single unit. This encapsulation and microservice architecture support creating small applications that focus on doing one thing—and doing it the best. This makes the sidecar pattern a popular approach for separating the main container from the business logic and adding additional sidecar containers to perform other tasks, such as log collection, metric publishing, or data caching. &lt;/p&gt;

&lt;p&gt;Running sidecars next to the main applications comes with a huge benefit: low (even close to zero) latency. On the other hand, since there is not a centralized database, the consistency of the data between database instances will be extremely low. Therefore, it is highly beneficial to deploy cache databases such as &lt;a href="https://redis.io/"&gt;Redis&lt;/a&gt; as sidecar containers. Because it’s  an in-memory cache, you can add a Redis container to each instance of your application and deploy it to Kubernetes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reliability in Chaos
&lt;/h2&gt;

&lt;p&gt;It is possible to run almost every kind of application on Kubernetes, including all major databases. However, you need to check some critical database characteristics against the high volatility—i.e., chaos—in Kubernetes clusters. In other words, it is common to see nodes go down, pods being rescheduled, and networks being fragmented. You need to ensure that the database you deploy on Kubernetes will resist these events and have the following characteristics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Failover and Replication
&lt;/h3&gt;

&lt;p&gt;It is common in Kubernetes to see some nodes being disconnected. If you have database instances running on these nodes, you and other database instances will lose access to them. Therefore, the database should support failover elections, data sharding, and replication to overcome any risks of data loss.&lt;/p&gt;

&lt;h3&gt;
  
  
  Caching
&lt;/h3&gt;

&lt;p&gt;Kubernetes is designed to run a high number of small applications; this means that databases with more caching and small data layers are more appropriate to run on the clusters. A well-known example is the native approach of &lt;a href="https://www.elastic.co/"&gt;Elasticsearch&lt;/a&gt; with its sharing of indices across instances in the cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Operators
&lt;/h3&gt;

&lt;p&gt;Kubernetes and its API are designed to run with minimal human intervention. Because of this, it is beneficial to use a database with a &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/"&gt;Kubernetes Operator&lt;/a&gt; to handle configurations, the creation of new databases, scaling instances up or down, backups, and restores.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managed Database vs. Database on Kubernetes
&lt;/h2&gt;

&lt;p&gt;Sharing the same infrastructure and Kubernetes cluster for stateless applications and databases is tempting, but there are some factors you need to take into account before choosing this route. We’ve already discussed the Kubernetes-friendly characteristics your database should have, but there are additional features required. &lt;/p&gt;

&lt;p&gt;If you've already ensured that the database has Kubernetes-friendly features, you’ll need to next consider the database workload and consequences. &lt;/p&gt;

&lt;p&gt;If you expect high resource usage, running on a Kubernetes cluster could be pricey compared to a managed service. On the other hand, running on Kubernetes could be a better option if you need a real-time and latency-critical database. &lt;/p&gt;

&lt;p&gt;Finally, you need to consider the operational requirements and your team structure. Databases have their own lifecycles, with patches, maintenance windows, and backups. Patches are inevitable and especially essential for security, as you need them to comply with security policies and certifications. Even if you use package managers or operators, you need to manually find the next version, which includes security patches.&lt;/p&gt;

&lt;p&gt;In a Kubernetes installation, you’re responsible for handling and managing these operations, whereas in a managed service, the cloud provider performs these functions for you. Using a managed database service could also be beneficial for your applications if you have critical performance indicators or SLAs. &lt;/p&gt;

&lt;p&gt;In short, you need to consider your requirements, budget, and operational capabilities before diving into a database installation on Kubernetes. &lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices for Running Databases on Kubernetes
&lt;/h2&gt;

&lt;p&gt;If you decide that Kubernetes is the best place to run your database, there are some best practices you should follow:&lt;/p&gt;

&lt;p&gt;Scalability: You should consider the horizontal and vertical scalability of your database in detail. It is suggested to use StatefulSets for horizontal scalability, and Kubernetes features such as &lt;a href="https://cloud.google.com/kubernetes-engine/docs/concepts/verticalpodautoscaler"&gt;vertical Pod autoscalers&lt;/a&gt; to extend for CPU and memory usage.&lt;/p&gt;

&lt;p&gt;Operations: Automation is vital for a successful Kubernetes installation, and it is suggested to deploy Kubernetes Operators first and then create database instances as &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/"&gt;Kubernetes custom resources&lt;/a&gt;. However, if your databases are constantly built and destroyed, custom resources are not the best option since they can create residual Kubernetes resources in the cluster.&lt;/p&gt;

&lt;p&gt;GitOps and configuration as code: Store every change in the source repository, and, following GitOps principles, deploy automatically when developers make changes.&lt;/p&gt;

&lt;p&gt;Monitoring, visibility, and alerts: Ensure that you collect metrics and logs and create alerts based on usage, user access, and database health. &lt;/p&gt;

&lt;p&gt;Troubleshooting with tools and playbooks: Failovers are unavoidable, and you need to be prepared to take action with predefined playbooks, tools, and helper scripts. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Kubernetes is the latest game-changer in cloud-native software development to run stateless applications and databases. However, where you deploy your database depends on your requirements, budget, and operational capabilities. &lt;/p&gt;

&lt;p&gt;If you don’t have solid use cases, it may not be worth it to jump on the database-on-Kubernetes wagon simply due to the hype or for a single-line Helm installation. &lt;/p&gt;

&lt;p&gt;If you do opt for Kubernetes, there is no silver-bullet approach. However, with the best practices and database characteristics discussed above, you should be able to successfully design your database deployments running on Kubernetes clusters. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally published on the &lt;a href="https://zesty.co/blog/deploy-databases-kubernetes/"&gt;Zesty Blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>database</category>
      <category>devops</category>
    </item>
    <item>
      <title>EBS vs. EFS: Which Storage System Is Right For You?</title>
      <dc:creator>Zesty_tech</dc:creator>
      <pubDate>Fri, 07 Apr 2023 16:23:47 +0000</pubDate>
      <link>https://dev.to/zesty_tech/ebs-vs-efs-which-storage-system-is-right-for-you-2c77</link>
      <guid>https://dev.to/zesty_tech/ebs-vs-efs-which-storage-system-is-right-for-you-2c77</guid>
      <description>&lt;p&gt;&lt;a href="https://zesty.co/blog/ebs-vs-efs-which-is-right/"&gt;This post was originally on the Zesty blog&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EBS vs. EFS–which makes the most sense for your business? Unfortunately, there’s no one size fits all approach.&lt;/p&gt;

&lt;p&gt;Choosing the correct storage solution for your AWS workloads can sometimes be quite confusing–and this is especially true when you try to balance efficiency, performance, flexibility and costs for constantly changing applications. There are many services available with different storage types and feature sets, so it’s easy to get overwhelmed when you’re in the comparison stage of your &lt;a href="https://zesty.co/blog/early-cloud-cost-optimization/"&gt;cloud optimization journey&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this article, we’ll compare two major storage services: Amazon Elastic Block Storage (Amazon EBS), and Amazon Elastic File Service (Amazon EFS). Both of these services offer great solutions if your application needs access to data via filesystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon EBS
&lt;/h2&gt;

&lt;p&gt;Amazon Elastic Block Store (EBS) is a highly performant block storage service that creates standalone virtual hard drives in the cloud and attaches those volumes to Amazon Elastic Compute Cloud (EC2) virtual machines.&lt;/p&gt;

&lt;p&gt;AWS customers have been using EBS since its early days for almost all types of demanding workloads like databases, applications, email, file storage, backup, or websites. EBS volumes are easy to create and configure and can be scaled to deliver extremely high IO performance. These volumes are also highly available and durable. Although EBS volumes are not replicated across multiple Availability Zones, they are copied to multiple servers in the same AZ, thus offering 99.99% availability and up to 99.999% durability. Users can also encrypt EBS volumes for data security at rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon Elastic File System (EFS)
&lt;/h2&gt;

&lt;p&gt;Amazon Elastic File System (EFS) is a &lt;a href="https://aws.amazon.com/efs/"&gt;managed Network File System (NFS)&lt;/a&gt; designed for Linux-based EC2 instances, selected AWS managed services, and on-premise servers. There’s a similar storage system for Windows hosts called the &lt;a href="https://aws.amazon.com/fsx/windows/"&gt;Amazon FSx for Windows File Server&lt;/a&gt;. FSx uses the Server Message Block (SMB) protocol while EFS uses NFS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparing EBS vs. EFS Systems
&lt;/h2&gt;

&lt;p&gt;While EFS is a managed elastic file system designed for use across different machines and availability zones, EBS is designed as a fast and reliable block storage volume for single machines (although EBS multi-attach is an exception to this that applies only on very specialized scenarios).&lt;/p&gt;

&lt;p&gt;There are other differences between the two storage systems which we’ll specify below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Access
&lt;/h3&gt;

&lt;p&gt;Like a physical hard drive, an EBS volume can be attached to a single EC2 instance (except for multi-attach use cases). The EC2 instance needs to be in the same availability zone as the EBS volume. Files in an EBS volume are accessible by filesystems like ext3, ext4, or xfs.&lt;/p&gt;

&lt;p&gt;EFS filesystems, on the other hand, can be mounted on multiple machines from any availability zone or even from on-premise servers. Thousands of machines can connect to the same EFS folder. File system access is via the NFS protocol.&lt;/p&gt;

&lt;p&gt;EBS volumes can be attached to both Windows and non-Windows EC2 machines, whereas EFS volumes are designed for Linux-based hosts only.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage Size
&lt;/h3&gt;

&lt;p&gt;While the maximum size of an EBS volume can be up to 16 TB, EFS volume sizes are practically unlimited. The maximum size of a file in EFS is 47.9 TB.&lt;/p&gt;

&lt;h3&gt;
  
  
  Availability and Scalability
&lt;/h3&gt;

&lt;p&gt;Although EBS volumes are not replicated across multiple Availability Zones, they are copied to multiple servers in the same AZ, thus offering 99.99% availability and up to 99.999% durability. Users can also encrypt EBS volumes for data security at rest.&lt;/p&gt;

&lt;p&gt;Like EBS, EFS also offers high durability. However, the main difference lies in scalability. EFS volumes can scale up quickly and automatically to meet abrupt spikes in workload demand and scale down with a decreased load. This makes EFS more flexible and better at handling dynamic workloads than EBS.&lt;/p&gt;

&lt;p&gt;This scalability also means EFS volumes don’t need to be pre-provisioned with a specific size for an anticipated load, which ultimately saves costs. Similar to EBS, you can also specify a provisioned throughput for EFS volumes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backup and Encryption
&lt;/h3&gt;

&lt;p&gt;Backups and encryption-at-rest are available for both systems.&lt;/p&gt;

&lt;p&gt;EFS also offers &lt;a href="https://docs.aws.amazon.com/efs/latest/ug/lifecycle-management-efs.html"&gt;lifecycle management&lt;/a&gt;, a price-saving feature similar to S3 lifecycle management. EFS lifecycle management enables the automatic and transparent transfer of infrequently accessed data to a separate storage class.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;p&gt;You can configure EBS volumes to minimize disk latency. You can do this by choosing different types of storage (SSD, HDD, etc.), specifying provisioned IOPS, and selecting EBS-optimized EC2 instances.&lt;/p&gt;

&lt;p&gt;EFS, on the other hand, isn’t as configurable as EBS. Although the baseline performance is fast enough for most workloads, it’s unable to provide low disk latency per IO operation like EBS. On the other hand, EFS – being a distributed file storage system – can handle a much higher throughput per second compared to EBS.&lt;/p&gt;

&lt;p&gt;Check &lt;a href="https://docs.aws.amazon.com/efs/latest/ug/performance.html"&gt;AWS documentation&lt;/a&gt; for more details on EFS performance, and download our EBS e-book to learn how to adjust EBS performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost
&lt;/h3&gt;

&lt;p&gt;Costs will increase in both EBS or EFS with increasing provisioned performance. However, as a rule of thumb, EBS will be less expensive than EFS for the same performance per GB.&lt;/p&gt;

&lt;p&gt;That said, mounting an EFS volume to multiple EC2 instances will have the same cost as mounting it to a single instance. In comparison, creating and attaching EBS volumes for every node may quickly add up to the bill.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;So where should you use one and not the other? Here’s a checklist.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If you need to access data from different machines or from different availability zones, EFS is probably your best option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EFS volumes are best suited for enterprise-wide file servers, backup systems, Big Data clusters, Massively Parallel Processing (MPP) systems, Content Distribution Networks (CDN), and other such large use cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Systems requiring a lot of throughput can also benefit from EFS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you need very low-latency disk operations, EBS is probably the best choice. EBS volumes are best suited for relational and NoSQL databases, enterprise applications like ERP systems, mail servers, SharePoint, web servers, directory servers, DNS servers, or middleware. That’s because these systems typically don’t run on large clusters, and therefore don’t need commonly mounted volume. Replication between servers is done on the application level, not on disk level. The performance requirements of these workloads can also be met by existing EBS volume types.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We hope you enjoyed this overview of two of AWS’s most popular storage systems, EBS and EFS. Whichever storage system you choose, we wish you an efficient and smooth cloud experience that enables you to scale as quickly and cost-effectively as possible.&lt;/p&gt;

&lt;p&gt;Refer to this &lt;a href="https://zesty.co/blog/zesty-disk-ebs-management/"&gt;blog post&lt;/a&gt; to learn more about &lt;a href="https://zesty.co/products/zesty-disk/"&gt;Zesty Disk&lt;/a&gt;, our solution for making EBS disks more dynamic and flexible than ever. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>storage</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
