Best Practices for Kubernetes Enterprises Deployment

nikki_slay
2 min readApr 7, 2020

--

Photo by Paramdeo Singh on Unsplash

Kubernetes automates application container lifecycle management, but it is complex to configure and manage. This post talks about 5 Kubernetes best practices.

Let’s start with the best practices!

  • Not allowing root users: All processes in a container run as the root user (uid 0) by default. Thus, prevention of this can be done by specifying a non-root and least-privileged user ID while building any container image. Also making sure that all application containers run as a non-root user.
  • Not adding new capabilities: Ensuring that application pods are unable to add new capabilities at runtime. Linux allows defining fine-grained permissions using capabilities, and it is possible to add capabilities with Kubernetes that allow other potentially dangerous behaviors by escalating the level of kernel access.
  • Not allowing changes to kernel parameters: Modifying Kernel parameters can be used as potential exploits. Thus adding new parameters should be highly restricted. The kernel allows modifications to its parameters at runtime using the Sysctl interface. These parameters in a Kubernetes pod can be specified as part of the kernel configurations.
  • Not allowing the use of host network and ports: Using the container host network interfaces will enable pods to share the host networking stack allowing potential snooping of network traffic across application pods.
  • Require pod resource requests and limits: It is highly recommended that demands and limits are configured for each pod to include CPU and memory resources, at least. Application workloads share cluster resources. Hence, it is essential to manage resources assigned for each pod.

--

--

nikki_slay
nikki_slay

No responses yet