在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