2020-08-31 11:01:56 -04:00
|
|
|
|
|
|
|
.. vca1590088383576
|
|
|
|
.. _enable-pod-security-policy-checking:
|
|
|
|
|
|
|
|
===================================
|
|
|
|
Enable Pod Security Policy Checking
|
|
|
|
===================================
|
|
|
|
|
2023-07-17 02:16:07 -04:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
PodSecurityPolicy (PSP) ONLY applies if running on K8S v1.24 or earlier.
|
|
|
|
PodSecurityPolicy (PSP) is deprecated as of Kubernetes v1.21 and removed from K8S v1.25.
|
|
|
|
Instead of using PodSecurityPolicy, you can enforce similar restrictions on Pods using
|
|
|
|
:ref:`Pod Security Admission Controller <pod-security-admission-controller-8e9e6994100f>`
|
|
|
|
|
2020-08-31 11:01:56 -04:00
|
|
|
.. rubric:: |proc|
|
|
|
|
|
2023-02-28 14:02:05 +00:00
|
|
|
#. Set the kubernetes kube_apiserver admission_plugins system parameter to
|
2020-08-31 11:01:56 -04:00
|
|
|
include PodSecurityPolicy.
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2021-03-15 16:56:04 -03:00
|
|
|
~(keystone_admin)]$ system service-parameter-add kubernetes kube_apiserver admission_plugins=PodSecurityPolicy
|
2020-08-31 11:01:56 -04:00
|
|
|
|
|
|
|
#. Apply the Kubernetes system parameters.
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2021-03-15 16:56:04 -03:00
|
|
|
~(keystone_admin)]$ system service-parameter-apply kubernetes
|
2020-08-31 11:01:56 -04:00
|
|
|
|
|
|
|
#. View the automatically added pod security policies.
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
$ kubectl get psp
|
|
|
|
$ kubectl describe <psp> privileged
|
|
|
|
$ kubectl describe <psp> restricted
|
|
|
|
|
|
|
|
|