我正在尝试将文件添加到kubernetes中AWX任务/ Web容器上的/ etc /目录中。我刚接触头盔,不知道自己在做错什么。
我添加到掌舵图中的唯一一件事是configmap中的krb5键,以及对任务和Web容器的附加卷和卷安装。 krb5.conf文件在图表/ mychart / files /
中ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "awx.fullname" . }}-application-config
labels:
app.kubernetes.io/name: {{ include "awx.name" . }}
helm.sh/chart: {{ include "awx.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
krb5: |-
{{ .Files.Get "krb5.conf"}}
secret_key: {{ .Values.awx_secret_key }}
awx_settings: |
*some stuff*
部署:
卷添加到Deployment.yaml的底部
volumes:
- name: {{ include "awx.fullname" . }}-application-config
configMap:
name: {{ include "awx.fullname" . }}-application-config
items:
- key: awx_settings
path: settings.py
- key: secret_key
path: SECRET_KEY
- name: {{ include "awx.fullname" . }}-application-config-krb5
configMap:
name: {{ include "awx.fullname" . }}-application-config
items:
- key: krb5
path: krb5.conf
卷装入同时添加到任务/ Web容器
volumeMounts:
- mountPath: /etc/tower
name: {{ include "awx.fullname" . }}-application-config
- mountPath: /etc
name: {{ include "awx.fullname" . }}-application-config-krb5
我正在尝试将文件安装到kubernetes容器中的容器上,并出现以下错误:
Warning Failed 40s kubelet, aks-prdnode-18232119-1 Error: failed to start container "web": Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/var/lib/docker/containers/d66044fe204abbf9a4d3772370d0f8d4184e339e59ad9a018f046eade03b8418/resolv.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/d9fa9705d70bbb864ed526a96f6a2873b2720c41a9f9ef5b4a428902e4cf3c82/merged\\\" at \\\"/var/lib/docker/overlay2/d9fa9705d70bbb864ed526a96f6a2873b2720c41a9f9ef5b4a428902e4cf3c82/merged/etc/resolv.conf\\\" caused \\\"open /var/lib/docker/overlay2/d9fa9705d70bbb864ed526a96f6a2873b2720c41a9f9ef5b4a428902e4cf3c82/merged/etc/resolv.conf: read-only file system\\\"\"": unknown
答案 0 :(得分:2)
您将要使用subPath:
选项“进入”该-application-config-krb5
并仅装入一个文件:
- mountPath: /etc/krb5.conf
name: {{ include "awx.fullname" . }}-application-config-krb5
subPath: krb5.conf
由于错误已正确指出,因此您肯定不想删除几乎任何容器环境的/etc
目录(它会破坏{{1} },/etc/passwd
,/etc/hosts
以及其他不计其数的重要文件)