【发布时间】:2021-02-11 14:37:20
【问题描述】:
我正在尝试以非 root 用户身份使用 Helm (v3.5.2) 连接和运行 AKS 集群 (v1.19.6) 中的 pod,并获得带有错误 I have no name! 的崩溃循环。 docker 镜像和服务在本地运行,在运行时作为正确的用户没有问题。
helm create mychart 之后,我在 values.yaml 中将我的安全设置为:
podSecurityContext:
runAsNonRoot: true
runAsUser: 123
securityContext:
# capabilities:
# drop:
# - ALL
#readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 123
deployment.yaml 如下。除了连接到我的 AKS 群集的参数之外,我没有修改任何其他内容:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "mychart.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
我的 Dockerfile 以
结尾USER 123
EXPOSE 8080
CMD [ "sh", "-c", "./blah; bash"]
我是否正确,这很可能是问题所在?我该如何解决问题?支持文档会非常有帮助,我发现的所有内容都已过时。
【问题讨论】:
-
能否请您显示该 Pod 的完整日志?此外,
kubectl describe pod也会很有用。
标签: kubernetes kubernetes-helm azure-aks kubernetes-pod