2025 GenAI Whitepaper

EKS Best Practices Guide for Security

Application Modernization

Explore security best practices for Amazon Elastic Kubernetes Service (EKS) to help maintain a strong security posture.

What is Kubernetes, and what is its relationship with Amazon EKS?

Kubernetes is an open-source platform for automating application container deployment, operation, and scaling. It simplifies container orchestration, making it easier to manage containerized applications across distributed environments.

Amazon Elastic Kubernetes Service (EKS) is AWS's managed Kubernetes service. It eliminates the need to install and manage your Kubernetes control plane or nodes on AWS. EKS integrates seamlessly with other AWS services, enhancing scalability, security, and reliability. 

In this blog, we will focus on security aspects, covering several critical areas for maintaining a strong security posture. Below, we outline some key concepts and best practices to consider.

AWS Shared Responsibility Model

Amazon Elastic Kubernetes Service (EKS) is a managed service where AWS takes care of certain security aspects, but customers still have responsibilities. Understanding this shared responsibility model is vital: AWS secures the infrastructure (the cloud) while you handle security for your applications, data, and network “in” the cloud. To manage your responsibilities effectively, focus on access controls, pod security, and data protection. 

Regarding node provisioning, you can vary between Self-Managed Nodes, Managed Node Groups, and EKS Fargate, which differ in control, automation, and cost.

Images from AWS EKS security documentation.

In summary:

  • Self-Managed Nodes require manual provisioning of EC2, offering greater control over configurations while demanding more operational effort.
  • Managed Node Groups simplify EC2 management, reducing overhead while still permitting customization.
  • EKS Fargate operates pods in a serverless setting, which saves costs for certain workloads but offers less flexibility compared to EC2.

As you move from self-managed workers to managed node groups and then to Fargate, AWS assumes greater responsibilities for infrastructure security.

Identity and Access Management (IAM)

Protecting access to your information and EKS clusters is critical to maintaining a secure environment. Access control goes beyond convenience; missteps can lead to significant security risks. Implementing strict Identity and Access Management (IAM) policies is essential for managing who can access your EKS clusters and what actions they can perform.

IAM is the backbone of AWS security; without well-defined IAM rules and policies, organizations may face several risks, including unauthorized users accessing sensitive data, non-compliance with regulations, increased operational costs, and challenges in auditing and accountability.

  • Enforce least privilege principles by granting the minimum permissions necessary for applications and applications to perform their tasks. Regularly review and update IAM policies to align with changing requirements. For more information, consult AWS documentation on granting least privileges access.
  • Leverage Pod Identity to bind an IAM role to a Kubernetes service account, removing the necessity to set up an OpenID Connect (OIDC) or identity provider (IDP) for each cluster within your AWS account. This approach simplifies authentication by alleviating the burdens of OIDC provider management, boosts security by minimizing the attack surface from having numerous identity providers, and streamlines role management by enabling centralized and consistent application of IAM roles across multiple clusters.
  • Regularly audit IAM policies with AWS IAM Access Analyzer and AWS CloudTrail to mitigate unauthorized access risks. The Access Analyzer detects overly permissive policies, and CloudTrail tracks user activity for threat detection and compliance.

Image Security

Your image configuration should act as the first line of defense against potential threats; poor image construction can result in security breaches and serve as the initial method for accessing your host. If an intruder gains entry to your host, they may exploit other vulnerabilities, enabling them to move laterally and potentially analyze your AWS accounts and resources.

Given this, thoughtfully considering how you create images within the environment is crucial.

  • Build images from scratch or remove unnecessary resources. This reduces the exposed area by including only the necessary binaries and removing unnecessary resources from your pre-built images for the same purpose. Also, you can manage the updates better and be aware of any vulnerabilities found in your installations.
  • Have your container images regularly scanned for vulnerabilities, as they may harbor at-risk binaries. Consistent use of an image scanner is essential. Using ECR images can scan your images on push or on-demand. Delete or rebuild images with high or critical vulnerabilities and replace deployed images where new vulnerabilities are found.
  • Regularly update and patch container images. To mitigate known vulnerabilities and keep container images current, use scanning tools, such as Amazon Inspector, to identify security issues.

Pod Security

Protecting pods guards against vulnerabilities and unauthorized access. The pod specification outlines features that influence your security. Therefore, preventing container processes from breaching isolation and accessing the host is essential. This focused strategy reduces the attack surface and mitigates risks associated with pod vulnerabilities, facilitating secure operations in your EKS cluster.

  • Restrict the containers operating in privileged mode when running Self-Managed Nodes or Managed Node Groups. While a root-running container may ease development and troubleshooting, it's inappropriate for production settings. Privileged containers inherit all Linux capabilities granted to the host's root user, which can be explored in case of unauthorized access.
  • Implement Pod Security Standards (PSS) and Pod Security Admission (PSA) for your pod security. PSS defines three security levels: Privileged, Baseline, and Restricted. While PSA applies these standards at the namespace level, checking Pods against PSS and enforcing three modes: Enforce (blocks non-compliant Pods), Warn (alerts but allows deployment), and Audit (logs violations). The appropriate policy is crucial for maintaining container isolation and security and ensuring workloads follow best practices.

Network Security

Network security entails controlling traffic and protecting data. Policies and security groups define rules for traffic flow and access. Inadequate security risks include data breaches, service disruptions, compliance violations, resource misuse, and poor visibility for threat detection. Organizations can mitigate these risks by implementing robust measures to ensure a secure infrastructure for safe data transmission.

  • Use Security Groups for Pods to regulate both inbound and outbound network traffic at the cluster instance level. These groups establish network security protocols for pods and AWS service communications.
  • Use VPC CNI in Kubernetes for secure pod communication. Assign IPs from the VPC range and utilize security groups to manage traffic at the pod and cluster levels. This ensures only authorized traffic accesses your pods while allowing detailed ingress and egress rule control for enhanced private subnet security.
  • Implement Network Policies to manage traffic flow between Pods, enhancing security through least privilege access. Limiting traffic to essential connections helps prevent unauthorized communication and supports adherence to security best practices. Keep in mind that Kubernetes clusters allow Pod-to-Pod communication by default.
  • Use a Private Endpoint for the API Server to limit access to internal networks and prevent exposure to the public internet. This enhances security by reducing the risk of unauthorized access and ensuring that only trusted internal sources can communicate with the Kubernetes API.
  • Employ TLS to encrypt data during transmission, protecting sensitive information. It is essential to configure your EKS to create secure communication channels among its components and with external services. Nitro instances automatically encrypt traffic, and encryption in transit through a service mesh can be implemented. Additionally, Ingress controllers effectively route HTTP/S traffic from external sources to services within the cluster.

Encrypting data

Encrypting sensitive data enhances security. AWS Key Management Service (KMS) facilitates data encryption and decryption, providing secure key management. This ensures intercepted data remains unreadable without the decryption key, which is essential in cloud environments where data is often transmitted and stored. Leveraging KMS allows organizations to enforce encryption standards, maintain confidentiality, comply with regulations, protect sensitive information from breaches, and ensure integrity throughout its lifecycle. This highlights the critical role of KMS in strengthening data security.

  • Enhance Kubernetes secrets security by using KMS to encrypt them in etcd. The KMS plugin stores secrets as ciphertext, ensuring only the Kubernetes API server can decrypt them, adding an extra layer of protection.
  • Use AWS Secrets Manager Integration to store and manage sensitive info like database credentials, API keys, and other configuration secrets. Use IAM roles and policies to restrict access to secrets for specific Kubernetes Pods in an AWS Secrets and Configuration Provider (ASCP) cluster.
  • Encrypt EBS volumes and S3 buckets used by the cluster to safeguard data at rest. Configure encryption policies to automatically apply encryption to new resources.
  • Rotate encryption keys regularly to enhance security. Use AWS KMS key policies to control access to encryption keys and monitor key usage.

Multi-Tenancy

When examining tenant isolation in cloud environments, it’s common to focus mainly on resources, ensuring that each tenant's resources are either logically or physically segregated. This typically includes methods like soft multitenancy, where tenants share the same cluster with logical separations, or hard multitenancy, which offers greater isolation through dedicated clusters or infrastructure. While this strengthens isolation, it also raises costs due to the rigid separation. Nonetheless, tenant isolation encompasses more than just resource separation; it’s about anticipating the consequences of a resource breach, as we mentioned in the image security by moving laterally. By adopting strong practices such as network segmentation, access control policies, and identity-based restrictions, you can minimize the impact of potential security incidents and improve the overall resilience of your environment using the multi-tenant strategy.

Detective Controls and Incident Response

While effective preventive measures are essential, having sufficient detective controls to identify and address security incidents within your EKS cluster quickly is just as necessary. Gathering and reviewing logs from your environment is vital for multiple reasons. Implementing proactive monitoring tools and strong alerting systems ensures you receive immediate notifications of anomalies, unauthorized access attempts, or suspicious behavior.

  • Keep collecting and auditing your environment, which can assist in root cause analysis and attribution, linking changes to specific users or services. Sufficient logs can also identify anomalous behaviors. On EKS, audit logs are sent to Amazon CloudWatch Logs.
  • Use Amazon GuardDuty to detect threats by analyzing logs and events and identifying unusual access patterns and potential breaches. Integrating it with CloudWatch Alarms and SNS provides real-time alerts for quick incident response and improved cluster security.
  • Use CloudTrail to track AWS API access. The accesses and the service account name are logged automatically. You can use CloudTrail Insights, which can also analyze write management events and alert you to unusual activity.

Rapidly identifying and addressing issues can significantly reduce potential damage. When an incident occurs, having a clear plan in place allows you to determine whether the container resource should be replaced, destroyed, or isolated for additional investigation. A thoroughly developed response plan ensures you can promptly mitigate risks and restore security within your environment.

How can Caylent help?

Securing EKS clusters is an ongoing challenge that demands continuous attention, expertise, and vigilance. We've already shared some essential security best practices to help you. Still, it’s important to consider other key areas, such as infrastructure security and multi-account strategies. By implementing these strategies, you can effectively safeguard your applications, protect sensitive data, and ensure compliance with industry standards.

This guide offers detailed advice on securing your clusters and staying current with the latest security practices. For additional information in each section, refer to the AWS documentation on EKS Security, or join the Amazon EKS Security workshop for hands-on insights through practical labs. To learn about best practices for running production-grade EKS clusters, check out our blog post: Production-Grade EKS Clusters: Best Practices for Scalability, Security, and Efficiency.

If you're looking to streamline your containerized application management with Amazon EKS, Caylent can help. Our team of experts can assist you in implementing best practices for Amazon EKS clusters, ensuring that your applications are robust, secure, and scalable. Contact us today to learn more about how Caylent can help you elevate your EKS strategy.

Application Modernization
Leticia Albuquerque

Leticia Albuquerque

As a Cloud Architect at Caylent with 9 years of experience in technology, Leticia has been immersed in the world of AWS since 2018, holding 9 certifications on the platform. Passionate about cloud architecture, she bring deep experience to imagine and implement impactful solutions for clients from a plethora of industries. In addition to technology, she is also a gaming enthusiast and finds joy in outdoor adventures with her husband and children.

View Leticia's articles

Learn more about the services mentioned

Caylent Catalysts™

Application Modernization Strategy

Modernize your applications on AWS with a customized plan that aligns with your unique business needs and goals.

Accelerate your cloud native journey

Leveraging our deep experience and patterns

Get in touch

Related Blog Posts

eBook: A Guide to Legacy Application Modernization

Application Modernization

Production-Grade EKS Clusters: Best Practices for Scalability, Security, and Efficiency

Learn how Amazon Elastic Kubernetes Service (EKS) simplifies Kubernetes cluster management by providing robust tools, security practices, and scalability solutions for production environments.

Application Modernization

Modernizing Online Educational Platforms on AWS: Enabling Reliable Student Experiences

Learn how we helped an education technology company with a seamless transition to AWS, delivering high availability, disaster recovery, cost savings, compliance, and improved visibility for the customer's network infrastructure.

Infrastructure & DevOps Modernization
Application Modernization