TL Consulting Group

Optimise Kubernetes cost

Application Security in Kubernetes

“Shift Left” Application Security in Kubernetes with Open Policy Agent (OPA) and Tanzu Mission Control (TMC)

“Shift Left” Application Security in Kubernetes with Open Policy Agent (OPA) and Tanzu Mission Control (TMC) To secure a Kubernetes environment, we must adopt the “shift left” security approach right from the initial phases of the development, rather than wait for the deployment to complete and focus on the security at later stages of the build. Kubernetes security is constantly evolving with new features to strengthen both the application and cluster security. Kubernetes offers several mechanisms to administer security within the cluster. Some of these include enforcing resource limits, API security, standardizing containers, auditing and so on. Here we will discuss one of such mechanism, which helps to implement the shift left security in a Kubernetes cluster. What is OPA? Open Policy Agent (OPA) is an open-source policy engine that provides a way of manifesting the policies declaratively as code, which helps to ease out some of the decision-making processes with the Kubernetes cluster end users, such as developers, operations teams without impacting the agility of the development. OPA uses a policy language called Rego, which allows you to write policies as code for various services like Kubernetes, CI/CD, Chef, and Terraform using the same language. OPA enforces the separation of concern by decoupling the decision-making from the core business logic of the applications. OPA Workflow: OPA provides centralized policy management and generates policy decisions by evaluating the input data against policies (written in Rego) and data (in JSON) through RESTful APIs. Here we have some of the example policies we can enforce using OPA: Which users can access which resources? Which subnets egress traffic is allowed to? Include node and pod (anti-), affinity selectors, on Deployments Which clusters a workload must be deployed to? Ensure all the images come from a trusted registry Which OS capabilities a container can execute with. Implementing Kubernetes Admission Controllers to validate API requests. Allowing or denying Terraform changes based on compliance or safety rules. Enforcing certain deployment policies (such as resource limits, meta data types of resources) Creating Custom Policies using OPA in Tanzu Mission Control (TMC) VMware Tanzu Mission Control is a centralized hub for simplified, multi-cloud, multi-cluster Kubernetes management. Tanzu Mission Control aims to help with the following list of Kubernetes operations: Managing clusters on both public, private cloud and edge Cluster lifecycle management on supported providers Manage security across multiple clusters Centralized policy management Access management Cluster conformance VMware Tanzu Mission Control provides centralized policy management for specific policies that you can use to govern your fleet of Kubernetes clusters, The polices include access controls, image registry policies, and resource limit policies. While these cover the baseline polices, it also offers an ability to create custom policies using Open Policy Agent (OPA). Custom policies are somewhat open-ended and provide the opportunity to address aspects of cluster management that specifically suit the needs of your organization. As described above OPA implement specialized policies that enforce and govern your Kubernetes clusters. Closing thoughts: Enterprises use the OPA to enforce, govern, audit, and remediate policies across all IT environments. You can use OPA to centralize operational, security, and compliance aspects of Kubernetes, in the context of cloud-native deployments, (CI/CD) pipelines, auditing and data protection. Thus, OPA enables DevOps teams to shift control over application authorization further left to advance the adoption of best DevSecOps practices. TL Consulting TLConsulting brings its consulting and engineering personnel to application modernisation adoption and implementation by providing range of services – as If you need assistance with your Containers/Kubernetes adoption, please contact us at our kubernetes consulting services  page.

“Shift Left” Application Security in Kubernetes with Open Policy Agent (OPA) and Tanzu Mission Control (TMC) Read More »

Uncategorised,

How to Optimise Kubernetes Costs?

How to Optimise Kubernetes Costs? The increasing popularity of cloud-native applications has brought technologies like microservices and containers to the frontline. Kubernetes is the most preferred container orchestration platform by most enterprises for automating the deployment, scaling, and management of containers. Most of the Kubernetes implementations thrive to focus on technical aspects and are least bothered by the costs involved with their benefits. In a recent survey from the Cloud Native Computing Foundation (CNCF), 68% of participants reported that their Kubernetes costs increased in the past year, with bills surging more than 20% year-on-year for most organisations. So, how to optimise Kubernetes costs? How much has your Kubernetes-related spend grown in the last 12 months?   Source:  FinOps Foundation survey When looking at optimising the infrastructure costs, enterprises consider various cost-management best practices, but Kubernetes require a specialised approach. Here we will discuss some of the key aspects to reduce overall Kubernetes costs. Size of the infrastructure as per the need: First and foremost, reducing the consumption costs is to have the correct infrastructure size in terms of pods and nodes. While it is always advisable to overprovision to cater to the unusual spikes, leaving the applications to use unlimited resources can lead to unexpected repercussions. For instance, a stateful database container consumes all the available memory in the node due to an application fault; this leads other pods to wait indefinitely for the resources. This can be prevented by setting up Quotas at Pod and namespace levels. Additionally, it is good to enforce the resource request limits at a container level. Other enforcement is to limit the number of pods running on a node, as running many pods can lead to inefficient resource utilisation. Due to this issue, most cloud providers have set hard limits on their managed instances if Kubernetes. Choosing the right tools: A fundamental way of managing any cloud or infrastructure costs is by monitoring utilisation and costs involved for the resources over a period. It allows users to get better insights into storage, memory, computing, network traffic utilisation, etc, and how the costs associated are distributed between them. Irrespective of managed instances or bare-metal clusters, today, almost all the clusters support one or other tools for monitoring to get the basic information. Suppose we are looking at an enterprise with many clusters. In that case, it is always advisable to have a propriety APIM tooling like Dynatrace, New Relic, App D, Splunk, and Prometheus and so have a proper drill-down of the resources and utilisation. It enables SREs and Kubernetes admins to gain a more comprehensive view of the environment and optimise the costs. Use the monitoring insights to analyse and create actions. And start implementing more concrete actions for better utilisation and cost optimisation.  Adopting the Best Practices Across the Delivery Pipeline: DevOps is a proven practice which helps to reduce the barriers between the Development teams and Operations. It allowed users to create robust and flexible deployments through pipelines. One of the possibility of reducing the time and effort to deploy containers to the Kubernetes cluster is to automate the build and deployment pipelines using CI/CD tooling. Also, practices like GitOps are tailor-made to facilitate continuous delivery when manifests are used and version-controlled in a source code repository, greatly reducing the deployment workloads of the team. An Initial investment will be needed to set up a continuous integration to build, test, and publish containers and continuous delivery to deploy these containers on the cluster. Tools like Harness Argo CD will significantly reduce the manual errors that can cause disruptions in the application, leading to less troubleshooting. This reduced workload will allow teams to focus on more valuable tasks such as functionality development, bug fixes, and improving the security posture of the environment. Conclusion: Kubernetes deployments and operations can be very costly if implemented and managed inefficiently. Most enterprises incorporate Kubernetes without any proper practices, tooling, and personal experience in the organisation. However, without proper guidance, it is often will become unoptimised and businesses don’t think about expenses forefront and will be a heavy operational burden in the long run. Considering the above-mentioned practices could save a lot of unnecessary Kubernetes costs and encourage the implementation of best practices from the beginning. TL Consulting TLConsulting brings its consulting and engineering personnel to application modernisation adoption and implementation by providing range of services – as If you need assistance with your Containers/Kubernetes adoption, please contact us at our kubernetes consulting services  page.

How to Optimise Kubernetes Costs? Read More »

Uncategorised,