A summary of actions to secure Kubernetes

The crypto mine hackers can harvest Kubernetes clusters to earn crypto mining dollars. attacks on Tesla and the 2019 Discovery of Docker engine worm were a few early examples of such attacks?

Here is a summary of? actions that a Kubernetes cluster owner can take to secure it

Basics?

  • Ensure proper authentication and authorisation of K8s cluster and don’t allow enabling Anonymous logins or disabling RBAC etc
  • Secure communication between all components of K8s?
  • Enabling etcd data encryption
  • Review Admission controllers and disable unnecessary admission controllers. Only mutating admission controllers from only well-respected sources be used.
  • Any Dashboards which don’t require authentication and proper authorisation should not be used.

Build and Deploy processes security

  • Review security attributes of all Kubernetes workload and configure using principle of least privileges required to get the job done
  • Audit PodSecuirtyPolicy. Open-source tools such as kube-psp-advisor should be used to establish a good Pod security policy.
  • Review and incorporate steps for container image hardening. CIS Docker benchmarks are an excellent way of starting container image hardening. CIS has put together guidelines for DockerFile hardening.?
  • Incorporate Image scanning tools in the Build process/CICD. GitHub - anchore/anchore-engine: A service that analyzes docker images and applies user-defined acceptance policies to allow automated container image validation and certification? is an excellent open-source image vulnerability scanner.
  • Configure Kubernetes security context of all workloads with the principle of least privileges. Resource requests and service accounts for workloads should also use the same principle of least privilege. Access to system resources, host paths, and unneeded OS capabilities should be disabled.

Runtime and operations security

  • Ensure Kubernetes Audit policy is enabled to log all events and activities
  • Establish good network policies which use the principle of least privilege to protect ports and communication
  • Image scanning admission controllers such as https://github.com/sysdiglabs/image-scanning-admission-controller? can prevent the launch of vulnerable workload?
  • For node, security use Linux kernel security modules such as AppArmor
  • Use an open policy agent to ensure images from trusted sources can be launched
  • Good monitoring and alerting using Grafan/Prometheus. Understand bots and agents try not to be very obvious CPU and other resource hoggers.?
  • Tools like Falco to detect and notify suspicious activities
  • Use tools like Hasicorp Vault or Public cloud secrets management services e.g., AWS Secrets, to manage application secrets

Ajmal Mahmood

[email protected]

Rohit Mishra

Senior Solutions Engineer (Containers|Kubernetes|Google Cloud Infrastructure)

3 年

Nice write up Ajmal! I would also add a couple more points from networking perspective, like having private clusters can help, that is not assigning the nodes an external IP, if out bound internet access is needed, consider NAT and lastly protect the control plane end points, managed Kubernetes on public clouds like Google or AWS provide ways to do so, like creating private clusters (no exposed public IP assigned to control plane) or even if control plane have to have an external IP, add authorized source CIDR blocks to access it, thus sort of putting it behind a virtual L4 firewall.

回复
Abdullah Bin Mustaqeem

2x AWS | 1x GCP | 1x Kubernetes | 1x Terraform Certified DevOps Engineer

3 年

Very important blog to read.

要查看或添加评论,请登录

Ajmal Mahmood的更多文章

  • My Comments on the MIT Review Case Study

    My Comments on the MIT Review Case Study

    AI Just beat a human test for creativity. What does that even mean Here is a summary of my views on AI and its…

  • High Plains Computing Services Brief

    High Plains Computing Services Brief

    CHALLENGE “We want to modernize our application stack into cloud-native serverless, Big data, and ML-based applications…

    1 条评论

社区洞察

其他会员也浏览了