BLOGKubernetes

Implementing Kubernetes: Best Practices For Getting It Right

Category
Kubernetes
Time to read
Published
February 20, 2024
Author

Key Takeaways

Understanding the roles of Workload Identities, Cluster Service Accounts, IAM Policies, and IAM Roles in managing access controls within AWS environments.

Exploring real-world use cases to illustrate the importance of effective IAM policy management in securing multi-tenant environments and aligning access controls with business requirements.

Comparing manual IAM policy management with streamlined approaches, such as Wayfinder's Package Workload Identities, to highlight the benefits of automation and centralised policy management.

Congratulations, after much pain and effort you finally have Kubernetes working. You may even have it working in production. But how do you know you've done everything right? How can you be sure your environment reflects best practices and is completely secure?

Here are just a few of the many questions to ask yourself to make sure you're covering all of your bases.

Do your applications work and play well with others?

Kubernetes assumes you can start application components in any order, which is difficult to test. In another example, you may not know what to set for application CPU and memory limits (or if you should set them at all).

It may take running the Vertical Pod Autoscaler with 'recommendation' mode enabled so you can get recommendations from the profiler. Or maybe you'd rather set values for everything via the LimitRange parameter on your namespaces.

Is your environment hackable?

Then, there's the biggest worry of them all: Security.

Take ServiceAccount for example, by default it is auto-mounted into the file system of all Pods. Do you want that, or would you rather disable it and provide more granular policies? Similarly, Role-Based Access Control (RBAC) rules are difficult to set up. What RBAC design philosophy should you implement? Will it work for all your users?

Can you prove your Kubernetes is implemented correctly?

Where to begin if you want to ensure your implementation is a good one?

First you’ll need to do an analysis of all your YAML configuration files (as well as Dockerfiles). Look for things such as containers running in privileged mode or anti-affinity rules being set incorrectly (again, this is just a small sample of the possible things to consider).

Then, you’ll need to do lots of displays via kubectl to get dynamic information like node status and resource quotas. Lastly, query the logs for errors on nodes, the control plane and general auditing.

At each of the above steps, validate your findings with known best practices.

An easy way to assess your risks

As early adopters of Kubernetes, and maintainers of kOps, we know all the places where Kubernetes implementation can fall down. On the strength of that knowledge, we've assembled a free 1-day assessment of your Kubernetes clusters to help you determine the relative robustness of your Kubernetes implementation.

The assessment measures and mitigates your Kubernetes risks against the checklist of priorities identified in the current CIS Kubernetes Benchmark:

  • Master Node Configuration
  • Control Plane Components & Configuration
  • ETCD Datastore
  • Worker Node Kubelet Configuration
  • RBAC Policies
  • Pod Security
  • Default Network Policies
  • General Cluster Policies

After a single-day audit of your clusters carried out by one of our expert architects, you'll receive a PDF of the results along with actionable insights on how to harden your security posture.

By working together, we can ensure you have the best possible Kubernetes configuration.

Related Posts

Related Resources