Config - Security Kontext Flashcards
At what levels can security be configured in Kubernetes in regards to containers?
- container level
- pod level
How far do pod-level configurations reach?
- to all containers running in the pod
What happens if security configurations are set at container and pod level?
- container level overwrites the pod level
How do you configure security context on a pod-level ?
pod Yaml
~~~
apiVersion
kind
metadata
spec:
securityContext:
runAsUser: 1000
containers:
- name: ubuntu
image: ubuntu
command: [“sleep”, “3600”]
~~~
How do you configure security context on a container-level ?
pod Yaml
~~~
apiVersion
kind
metadata
spec:
containers:
- name: ubuntu
image: ubuntu
command: [“sleep”, “3600”]
securityContext:
runAsUser: 1000
capabilities:
add: [“MAC_ADMIN”]
~~~
- Capabilities are only supported on the containter-level NOT pod-level
With what command can you find out what user a pod is running as?
kubectl exec ubuntu-sleeper – whoami
What does the ‘kubectl exec’ command start?
- enables to run a command in a specified container