text stringlengths 0 59.1k |
|---|
- 'emptyDir' |
- 'secret' |
- 'downwardAPI' |
- 'configMap' |
- 'persistentVolumeClaim' |
- 'projected' |
hostPID: false |
hostIPC: false |
hostNetwork: false |
<|endoftext|> |
# source: k8s_examples/_archived/podsecuritypolicy/rbac/pod.yaml type: yaml |
apiVersion: v1 |
kind: Pod |
metadata: |
name: nginx |
labels: |
name: nginx |
spec: |
containers: |
- name: nginx |
image: nginx |
ports: |
- containerPort: 80 |
<|endoftext|> |
# source: k8s_examples/_archived/podsecuritypolicy/rbac/roles.yaml type: yaml |
# restricted-psp-user grants access to use the restricted PSP. |
apiVersion: rbac.authorization.k8s.io/v1 |
kind: ClusterRole |
metadata: |
name: restricted-psp-user |
rules: |
- apiGroups: |
- policy |
resources: |
- podsecuritypolicies |
resourceNames: |
- restricted |
verbs: |
- use |
--- |
# privileged-psp-user grants access to use the privileged PSP. |
apiVersion: rbac.authorization.k8s.io/v1 |
kind: ClusterRole |
metadata: |
name: privileged-psp-user |
rules: |
- apiGroups: |
- policy |
resources: |
- podsecuritypolicies |
resourceNames: |
- privileged |
verbs: |
- use |
<|endoftext|> |
# source: k8s_examples/_archived/podsecuritypolicy/rbac/README.md type: docs |
## PSP RBAC Example |
This example demonstrates the usage of *PodSecurityPolicy* to control access to privileged containers |
based on role and groups. |
### Prerequisites |
The server must be started to enable the appropriate APIs and flags |
1. allow privileged containers |
1. allow security contexts |
1. enable RBAC |
1. enable PodSecurityPolicies |
1. use the PodSecurityPolicy admission controller |
If you are using the `local-up-cluster.sh` script you may enable these settings with the following syntax |
``` |
PSP_ADMISSION=true ALLOW_PRIVILEGED=true ALLOW_SECURITY_CONTEXT=true hack/local-up-cluster.sh |
``` |
The `kubectl` commands in this document assume that the current directory is the root directory of the cloned repository: |
```console |
$ git clone https://github.com/kubernetes/examples |
$ cd examples |
``` |
### Using the protected port |
It is important to note that this example uses the following syntax to test with RBAC |
1. `--server=https://127.0.0.1:6443`: when performing requests this ensures that the protected port is used so |
that RBAC will be enforced |
1. `--token=<token>`: this allows to make requests from a different users during testing. |
## Creating the policies, roles, and bindings |
NOTE: If you are using `local-up-cluster.sh` you don't need to create these |
policies, roles, and bindings as they already have been created by the script, |
provided the Kubernetes repository contains `examples` symlink pointing to |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.