PSP(Pod 安全策略)规范的一部分是不可见的(例如 hostIPC:false,priviledged:false ......等等)
你能告诉我为什么我不能检查吗?
[psp.yaml]
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: default
spec:
allowPrivilegeEscalation: false
hostIPC: false
hostNetwork: false
hostPID: false
privileged: false
readOnlyRootFilesystem: false
runAsUser:
rule: 'MustRunAsNonRoot'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
requiredDropCapabilities:
- NET_RAW
"default-psp.yaml" 21L
[psp创建]
[root@master01 ~]# kubectl create -f default-psp.yaml
podsecuritypolicy.policy/default created
[root@master01 ~]# kubectl get psp
NAME PRIV CAPS SELINUX RUNASUSER FSGROUP SUPGROUP READONLYROOTFS VOLUMES
default false RunAsAny MustRunAsNonRoot RunAsAny RunAsAny false
[root@master01 ~]#
[psp检查]
[root@master01 ~]# kubectl get psp default -o json
{
"apiVersion":"v1",
"items":[
{
"apiVersion":"policy/v1beta1",
"kind":"PodSecurityPolicy",
"metadata":{
"creationTimestamp":"2021-05-04T04:12:52Z",
"managedFields":[
{
"apiVersion":"policy/v1beta1",
"fieldsType":"FieldsV1",
"fieldsV1":{
"f:spec":{
"f:allowPrivilegeEscalation":{
},
"f:fsGroup":{
"f:rule":{
}
},
"f:requiredDropCapabilities":{
},
"f:runAsUser":{
"f:rule":{
}
},
"f:seLinux":{
"f:rule":{
}
},
"f:supplementalGroups":{
"f:rule":{
}
}
}
},
"manager":"kubectl",
"operation":"Update",
"time":"2021-05-04T04:12:52Z"
}
],
"name":"default",
"resourceVersion":"163847",
"selfLink":"/apis/policy/v1beta1/podsecuritypolicies/default",
"uid":"b8ed1cf3-7cb8-4f03-a5d4-d1f6d8fb51a0"
},
"**""spec":{
"allowPrivilegeEscalation":false,
"fsGroup":{
"rule":"RunAsAny"
},
"requiredDropCapabilities":[
"NET_RAW"
],
"runAsUser":{
"rule":"MustRunAsNonRoot"
},
"seLinux":{
"rule":"RunAsAny"
},
"supplementalGroups":{
"rule":"RunAsAny""**"
}
}
}
],
"kind":"List",
"metadata":{
"resourceVersion":"",
"selfLink":""
}
}
kube 版本:1.18.6