在Debian上部署Kubernetes時,確保其安全性是至關重要的。以下是一些關鍵的安全設置和最佳實踐:
sudo apt update && sudo apt upgrade -y
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: read-pods
subjects:
- kind: User
name: your-username
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: read-pods
apiGroup: rbac.authorization.k8s.io
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: example-network-policy
spec:
podSelector:
matchLabels:
app: example
policyTypes:
- Ingress
- Egress
egress:
- to:
- ipBlock:
cidr: 172.17.0.0/16