问题描述
我已在 GKE 上成功创建了 PodSecurityPolicy、CluserRole 和 ClusterRoleBinding。我现在正在尝试从 here 使用 OpenLDap。没有在 k8s 集群上安装我的 PodSecurityPolicy,这个 OpenLDap 的 helm 安装工作正常。
然而,当我安装 PSP 并尝试安装 OpenLDap 时,我的容器保持在 CrashLoopBackOff 状态。
我知道 openldap 需要连接到 ldapPort: 和 389 sslldapPort: 636 并且我知道那些是特权端口。我已经尝试将 psp yaml 中的特权设置更改为 true,但没有用。
PodSecurityPolicy yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
Metadata:
name: test-psp
spec:
privileged: false
allowPrivilegeEscalation: false
defaultAllowPrivilegeEscalation: false
allowedCapabilities:
- NET_ADMIN
- NET_RAW
defaultAddCapabilities: []
requiredDropCapabilities:
- ALL
hostPID: false
hostIPC: false
hostNetwork: false
# requiredDropCapabilities: false
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
volumes:
- '*'
集群角色
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
Metadata:
name: test-cluster-role
rules:
- apiGroups:
- policy
resources:
- podsecuritypolicies
verbs:
- use
resourceNames:
- test-psp
ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Metadata:
name: test-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: test-cluster-role
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: system:serviceaccounts
当我在 openldap pod 上进行描述时,我得到 Back-off restarting Failed container 我可能做错了什么,导致 openldap 停止运行。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)