Stay up to date
Kubernetes compliance under GDPR

Kubernetes compliance under GDPR

Jun 15, 2023

Henry Hernández
Sr. Solutions Architect

The General Data Protection Regulation (GDPR) is a data privacy and security regulation in the European Union (EU) that aims to protect individuals’ personal data collected and processed by businesses. 

The financial penalties for a company that is found to be non-compliant with GDPR can be significant: €20 million or 4% of its annual global revenues. Hence, it is essential for small and medium-sized businesses (SMBs) to understand how the regulation applies to their data processing and management practices.

In this article, I will discuss the GDPR principles and requirements on data privacy, how GDPR applies to Kubernetes compliance and best practices for achieving compliance in Kubernetes clusters.

GDPR principles and requirements on data privacy

Organizations must abide by seven fundamental principles listed in Article 5 of GDPR when handling personal data:

  • Lawfulness, fairness, and transparency
  • Purpose limitation
  • Data minimization
  • Accuracy
  • Storage limitation
  • Integrity and confidentiality
  • Accountability

In particular, GDPR requires companies to implement “appropriate technical and organizational measures” to ensure the security of personal data. This includes data protection “by design and by default,” meaning that privacy considerations must be built into the architecture and operation of systems that process personal data.

GDPR additionally grants EU-based individuals the right to access their personal data and to have their personal data erased. Companies must also notify the relevant authorities within 72 hours of a personal data breach.

How GDPR applies to Kubernetes compliance

For SMBs that are using Kubernetes, compliance with GDPR requirements for data privacy can be confusing, as GDPR does not specify how the principles should be applied in practice.

Leveraging existing Kubernetes security frameworks and guidance is key. The Kubernetes community has developed several security frameworks that provide a comprehensive set of guidelines for securing Kubernetes resources, including network and data management, as well as access control and authentication.

There are some primary considerations for Kubernetes compliance under GDPR, a few of which we discuss below. 

Access control and authentication 

When granting access to resources in the Kubernetes cluster, apply the principle of least privilege so that only authorized users have access to sensitive data. User authentication via mechanisms such as OpenID Connect (OIDC) and client certificates are also supported in Kubernetes so that all API requests to the Kubernetes API server in the cluster are authenticated.

Data management at rest and in transit 

Credentials and sensitive data should be encrypted at rest, while data in transit over the network should be secured by configuring control plane components to use encrypted communication via Transport Layer Security (TLS).

Network segmentation 

Leaving all traffic open within a network, that is, allowing all inbound and outbound traffic between pods and clusters, could lead to a compromised cluster when another cluster in the network is affected. Only necessary traffic should be allowed; all else should be denied by default if it is not required for the workloads to guarantee that only authorized pods can communicate with each other.

Auditing and continuous monitoring 

Enabling audit logging and continuous monitoring in the Kubernetes cluster is necessary for companies to provide evidence of having implemented “appropriate technical and organisational measures” in case of a personal data breach.

Best practices for Kubernetes compliance under GDPR

The following are some security best practices that DevSecOps engineers in SMBs can apply in their Kubernetes environments for GDPR compliance.

Set up Role-Based Access Control

Role-based access control (RBAC) is a built-in security model in Kubernetes for controlling access to resources based on roles and permissions. It is a best practice to set up RBAC for Kubernetes clusters to implement the principle of least privilege and ensure that only authorized users have access to network resources. This, in turn, helps prevent data breaches.

Organizations can implement RBAC in Kubernetes through the creation of roles, role bindings, and service accounts. Roles define the permissions that users or service accounts have within the cluster. Service accounts are typically used by pods inside the cluster to perform certain actions on cluster resources; they can be used to grant permissions to applications or services running in the cluster without the need for a client certificate (which is required for users). Role bindings map roles to users or service accounts.

You will first need to define the roles and permissions for the cluster. Next, create service accounts for the applications and services that will need to be able to access the cluster. Finally, you can map the roles to the service accounts using role bindings.

It is recommended that DevSecOps teams restrict access to the Kubernetes cluster to the minimum necessary for maintaining operations. This can be accomplished by creating different roles for different tasks, such as view-only access for monitoring and reporting and full administrative access for managing the cluster.

Use encryption to secure data at rest and in transit

To ensure data privacy and security, it is important to encrypt data at rest, such as when it is stored in the Kubernetes cluster. One way to achieve this is by using Kubernetes Secrets and encrypted storage volumes. Kubernetes Secrets allow you to store sensitive information, such as passwords and keys, securely in the cluster, while encrypted storage volumes provide an encrypted storage solution for your data.

Encryption is also important when data is in transit, for instance, over the network. It is recommended to use a service mesh such as Istio to encrypt all traffic between pods and to secure communication between services within the cluster.

Implement network segmentation and firewalling

Network segmentation involves dividing the network into isolated segments for better security and manageability. In the context of Kubernetes, network segmentation is achieved through the use of network policies.

Kubernetes network policies define the traffic rules for pods in a cluster, which allows the cluster administrator to control pod-to-pod network communications. Companies can also leverage network policies to limit network access between pods based on their namespaces, label selectors, or IP blocks. This helps make sure that only authorized pods can communicate with each other, thus lowering the risk of data breaches and unauthorized access.

In addition to network policies, Ingress is another important component of network segmentation in Kubernetes. Ingress allows the administrator to manage external network access to cluster services based on the IP address, host name, or URL path of the incoming request. This way, only authorized users can access the cluster and its services, thereby reducing the risk of a breach.

Setting up continuous logging, monitoring, and alerting

Setting up continuous logging, monitoring, and alerting is critical to demonstrate compliance with GDPR requirements. This can be done by implementing data loss prevention (DLP) systems; cluster logging, monitoring, and alerting; and continuous compliance monitoring.

DLP systems use deep packet inspection (DPI) to inspect all network connections. This is important because it enables the detection of any unauthorized access to personal data. In a Kubernetes environment, DLP systems can be integrated into the cluster as a custom resource, allowing them to inspect all traffic flow in the cluster.

Cluster logging, monitoring, and alerting are also critical to making sure that Kubernetes clusters are GDPR-compliant. FluentD, Prometheus, and Grafana are popular tools for collecting and visualizing logs from the Kubernetes cluster, allowing DevSecOps engineers to monitor the cluster for security incidents.

Continuous compliance monitoring is another essential factor in being GDPR-compliant. Automated scanning of the Kubernetes cluster against Kubernetes security frameworks such as CIS Benchmark and PCI DSS can help to identify and remediate security misconfigurations. This, in turn, enables you to avoid data breaches, which can result in significant fines under GDPR. Being able to demonstrate that the cluster is GDPR-compliant is also important in the event of an audit.


Ensuring compliance with GDPR is a must for SMBs using Kubernetes, as the penalties for non-compliance can be significant. By leveraging existing Kubernetes security frameworks to implement best practices for cluster security and log auditing, DevSecOps engineers can design and operate their Kubernetes clusters in a manner that meets GDPR requirements and protects the privacy and security of personal data.

Actionable, contextual, end-to-end
{Kubernetes-native security}

From code to cluster, helm to node, we’ve got your Kubernetes covered:

Cut the CVE noise by significantly reducing CVE-related work by over 90%

Automatic Kubernetes compliance for CIS, NSA, Mitre, SOC2, PCI, and more

Manage Kubernetes role-based-access control (RBAC) visually


Continue to Slack

Get the information you need directly from our experts!

new-messageContinue as a guest