---
title: What is Kubernetes security?
url: https://www.vmware.com/topics/kubernetes-security
description: "Learn about Kubernetes security, which is based on the 4C’s of cloud native security: Cloud, cluster, container, and code."
---

# What is Kubernetes security?

Kubernetes security is based on the 4C’s of [cloud native](https://www.vmware.com/topics/cloud-native) security: [Cloud](https://www.vmware.com/topics/cloud), [cluster](https://www.vmware.com/topics/kubernetes-cluster), [container](https://www.vmware.com/topics/containers), and code:

- **Cloud (or** [data center](https://www.vmware.com/topics/data-center)**/colocation facility):** The underlying physical [infrastructure](https://www.vmware.com/topics/cloud-infrastructure) is the basis of Kubernetes security. Whether the cluster is built on one’s own data center or a cloud provider, basic cloud provider (or physical security) best practices must be observed.
- **Cluster:** Securing a Kubernetes cluster involves both the configurable components such as the Kubernetes API and security of all the applications that are part of the cluster. Since most cloud-native applications are designed around [microservices](https://www.vmware.com/topics/microservices) and APIs, applications are only as secure as the weakest link in the chain of services that comprise the entire application.
- **Container:** Container design best practices consist of: starting with the smallest code base possible (excluding unnecessary libraries or functions), using principles of least privilege to avoid granting unnecessary privileges to users in the container, and ensuring that containers are scanned for vulnerabilities at build time.
- **Code:** Code presents a major attack surface for any Kubernetes environment. Simple policies such as encrypting TCP using TLS handshakes, not exposing unused ports, scanning, and testing regularly can help prevent security issues from arising in a production environment.

## Why Kubernetes security is important

Kubernetes security is important throughout the container lifecycle due to the distributed, dynamic nature of a Kubernetes cluster. Different security approaches are required for each of the three phases of an application lifecycle: build, deploy, and runtime. Kubernetes provides innate security advantages. For example, application containers are typically not patched or updated. Instead, container images are replaced entirely with new versions. This enables strict version control and permits rapid rollbacks if a vulnerability is uncovered in new code.

However, since individual pods are transient and ephemeral, the ever-changing runtime environment can present challenges for IT security professionals, as applications and API links to other applications and services are constantly in flux.

## Addressing Kubernetes security vulnerabilities

A compromised development environment, an application leveraging unpatched open-source packages or OS, an application development that lacks good security design practice, or attack surface with users as a potential entry point, are among the factors that impact security.

Kubernetes security tools should:

- Reduce time to ensure code is free of compromises.
- Provide digital signatures for a level of trust for code.
- Provide visibility and transparency not only in code but in configuration issues.
- Prevent ingress (incoming connection) or egress (outbound connection) of information to unsecure services.

### Top Kubernetes security vulnerabilities during build

- **Flawed from the first line:** Define a design and code review process that considers security concerns and model threats in this phase. Adopt a [zero trust](https://www.broadcom.com/topics/zero-trust) architecture such that two application components do not talk to each other unless verified.
- **Code from untrusted registries:** Supply chain security for the container images and other components that execute your application. Untrusted code can lead to [malware](https://www.broadcom.com/topics/malware) injection or backdoors that could unintentionally grant access to bad actors.
- **Bloated base images:** Less is more for containerized applications, so developers should eliminate unnecessary packages, libraries, and shells that could be compromised.

### Top Kubernetes security vulnerabilities during deployment

- **Implicit trust:** Adopt an architecture, such as zero trust, that minimizes attack surfaces. Ensure Role-Based Access Control (RBAC) policies to address who can deploy clusters and Pods and where it can be deployed.
- **Failure to isolate applications in the cluster:** [Namespaces](https://www.vmware.com/topics/kubernetes-namespace) should be used to keep applications, resources and teams separate from each other.
- **Lateral movement within the cluster:** Use policies that segment the network to prevent lateral movement of an attack within the cluster.

### Top Kubernetes security vulnerabilities during runtime

- **Infrastructure attacks:** During runtime, Kubernetes infrastructure elements including the API server, etcd, and controllers all present their own attack surfaces. These elements must be protected with isolation, automated certificate rotation, and role-based access control.
- **Vulnerable hosts and volumes:** Applications sharing a physical host are exposed to lateral attacks if a neighboring application is compromised. Encrypting data at rest and in motion can prevent severe financial loss to the organization.
- **Complexity:** The ongoing health of a Kubernetes cluster has many moving parts. Compromised containers must be quickly isolated, stopped, and replaced with healthy ones while the source of the attack is located and remediated.

## Kubernetes security high-level checklist

Best practice recommendations include:

- Begin with minimal, distro-less images and add only what is absolutely necessary.
- Use a minimal host OS, end read-only mounts, and use SELinux options for even more control.
- Scan images for vulnerabilities top to bottom, including OS images and outside images of any kind. There is no such thing as an outside trusted source.
- Use namespaces and RBAC to segment the cluster and users in a logical manner. If it’s not needed it shouldn’t be visible.
- [Kubernetes networking](https://www.vmware.com/topics/kubernetes-networking) defaults allow any-to-any communications, so [network segmentation](https://www.vmware.com/topics/network-segmentation) should be implemented before production. Carefully define ingress and egress policies to ensure connections are routed properly.
- Keep privileges to a minimum, and never run application processes as root. Using a read-only root filesystem prevents any attack that depends on installing software or modifying the file system.
- Integrate security such as image scanning into the [CI/CD](https://www.vmware.com/topics/cicd) pipeline. Even better, run CIS Benchmark security tests.
- Secure the cluster itself: Configure RBAC to limit access to the API server and ensure all etcd communications are secured with TLS encryption. Likewise, lockdown kubelet permissions by configuring RBAC for kubelets.
- Take advantage of built-in controls in Kubernetes, such as configuring security context to limit pod access.
- Proactive security should include monitoring of process activity, communications between services, and communications external to the cluster.

## How VMware products can help

[VMware vSphere Kubernetes Service (VKS)](https://www.vmware.com/products/cloud-infrastructure/vsphere-kubernetes-service) is the CNCF-certified Kubernetes runtime built directly into [VMware Cloud Foundation (VCF)](https://www.vmware.com/products/cloud-infrastructure/vmware-cloud-foundation) to run all modern apps. VKS is among the first platforms certified under the new CNCF Kubernetes AI Conformance Program. VKS enables platform engineers to easily deploy, manage, and scale [Kubernetes clusters](https://www.vmware.com/topics/kubernetes-cluster) while leveraging a comprehensive set of cloud services included in VCF, as well as all CNCF-conformant third-party services.

## Recommended for You

- [Kubernetes](https://www.vmware.com/topics/kubernetes)
- [Container Orchestration](https://www.vmware.com/topics/container-orchestration)
- [Kubernetes Infrastructure](https://www.vmware.com/topics/kubernetes-infrastructure)
- [Kubernetes Architecture](https://www.vmware.com/topics/kubernetes-architecture)

## Related Products and Solutions

- [VMware vSphere Kubernetes Service](https://www.vmware.com/products/cloud-infrastructure/vsphere-kubernetes-service)
- [VMware Cloud Foundation](https://www.vmware.com/products/cloud-infrastructure/vmware-cloud-foundation)
- [VMware Live Recovery](https://www.vmware.com/products/cloud-infrastructure/advanced-services/live-recovery)

## Also of Interest

- [What is Platform Engineering?](https://www.vmware.com/topics/platform-engineering)
- [VMware Tanzu Platform](https://www.vmware.com/products/app-platform/tanzu)
- [VMware Tanzu Kubernetes Grid Integrated - Enterprise Kubernetes...](https://www.vmware.com/products/app-platform/tanzu-kubernetes-grid)
