commit 9bd7f0330183f462a5fe69a1df4ba962262a80fb
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2022-03-15T16:27:38Z |
| subject | Use initContainers to fix the permissions |
commit 9bd7f0330183f462a5fe69a1df4ba962262a80fb
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2022-03-15T16:27:38Z
Use initContainers to fix the permissions
---
k8s.yaml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/k8s.yaml b/k8s.yaml
index e87a20e..30cccc9 100644
--- a/k8s.yaml
+++ b/k8s.yaml
@@ -18,6 +18,18 @@ spec:
runAsUser: 1001
imagePullSecrets:
- name: registry-auth
+ initContainers:
+ - name: init-dir
+ image: alpine:latest
+ command:
+ - chown
+ - 1001:1001
+ - /app/cache
+ securityContext:
+ runAsNonRoot: false
+ volumeMounts:
+ - name: cache
+ mountPath: "/app/cache"
containers:
- name: web
image: registry.k8s.astropenguin.net/astrojs:2022.03.15.04
@@ -56,7 +68,7 @@ spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
- storage: 10Gi
+ storage: 1Gi
storageClassName: local-storage
---