Created
January 25, 2022 18:21
-
-
Save edib/7f9a01031c6e6f48fa5518aea18050c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: example | |
spec: | |
containers: | |
- image: busybox | |
command: [ "sh", "-c", "sleep 84000s" ] | |
name: examplepod | |
env: | |
- name: NAME | |
valueFrom: | |
fieldRef: | |
apiVersion: v1 | |
fieldPath: metadata.name | |
volumeMounts: | |
- mountPath: /var/log/kokdemir | |
name: hostpath | |
subPathExpr: $(NAME) | |
securityContext: | |
runAsUser: 1001 | |
runAsGroup: 1001 | |
runAsNonRoot: true | |
allowPrivilegeEscalation: false | |
capabilities: | |
drop: | |
- all | |
initContainers: | |
- name: volume-mount-permission | |
env: | |
- name: NAME | |
valueFrom: | |
fieldRef: | |
apiVersion: v1 | |
fieldPath: metadata.name | |
image: busybox | |
command: ["sh", "-c"] | |
args: ["chown -R 1001:1001 /var/log/kokdemir/$(NAME)"] | |
volumeMounts: | |
- mountPath: /var/log/kokdemir | |
name: hostpath | |
subPathExpr: $(NAME) | |
readOnly: false | |
securityContext: | |
runAsUser: 0 | |
allowPrivilegeEscalation: true | |
volumes: | |
- name: hostpath | |
hostPath: | |
path: /var/log/kokdemir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment