Cluster Setup (10%)
- Use Network security policies to restrict cluster level access
- Use CIS benchmark to review the security configuration of Kubernetes components (etcd, kubelet, kubedns, kubeapi)
- Properly set up Ingress objects with security control
- Protect node metadata and endpoints
- Minimize use of, and access to, GUI elements
- Verify platform binaries before deploying
CIS benchmark
CIS Benchmark는 CIS(Center for Internet Security)에서 제공하는 IT시스템, 인프라 등을 안전하게 구성하기 위한 best practice 콜렉션을 뜻한다. CIS 벤치마크는 사이버 공격으로 부터 IT 시스템을 방어하기 위한 보안 표준으로 국제적으로 인정받고 있다.
다양한 Benchmark 세트들이 제공되고 있으며 그 중에서도 Kubernetes환경을 안전하게 구성하고 배포하기 위한 가이드라인인 CIS Kubernetes Benchmark에 대해 알아보자.
Kube-bench
kube-bench는 클러스터가 얼마나 CIS Benchmark 가이드라인을 준수하는지 체크하는 툴이다.
CIS Benchmark의 모든 룰을 살펴보는것은 너무나 긴 시간이 걸리기 때문에, Kube-bench라는 도구를 사용하여 간편하게 클러스터의 상태를 체크할 수 있다.
kube-bench 사용하기
kube-bench는 Container내부에서 실행하는 방법과, Kubernetes cluster에서 실행하는 2가지 방법을 제공한다.
단, Container 에서 실행하기 위해선 host PID namespace에 접근할 수 있어야 하므로 여기서는 Kubernetes Cluster에서 실행하는 방법을 알아본다.
※ CSP사에서 제공하는 Kubernetes의 경우 (GKE, EKS, AKS 등) Master Node에 접근할 수 없으므로 Worker Node만 대상으로 점검한다.
1. kube-bench job YAML file 다운받기
wget -0 kube-bench-control-plane.yaml https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job-master.yaml
wget -0 kube-bench-node.yaml https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job-node.yaml
2. job 생성
kubectl create -f kube-bench-control-plane.yaml
kubectl create -f kube-bench-node.yaml
3. 생성된 job 이 completed 될때까지 기다린다.
4. 결과 확인
- job의 log를 확인하면 kube-bench의 점검결과를 확인할 수 있다.
- 간편한 확인을 위해 각각의 log를 별도의 파일에 저장한다.
kubectl logs <Control plane Job Pod name > kube-bench-results-control-plane.log
kubectl logs <Node Job Pod name > kube-bench-results-node.log
'CKS' 카테고리의 다른 글
[CKS] Cluster Setup - Protect node metadata and GUI elements (0) | 2024.01.08 |
---|---|
[CKS] Cluster Setup - Ingress with TLS (1) | 2024.01.05 |
[CKS] Cluster Setup - CIS benchmark (kube-bench) #2 (1) | 2024.01.03 |
[CKS] Cluster Setup - NetworkPolicies (0) | 2024.01.02 |
[CKS] 시험 준비하기 (1) | 2024.01.02 |