pod“”中的容器“”正在等待启动:CreateContainerConfigError
container "" in pod "" is waiting to start: CreateContainerConfigError
pod“abc-job-manual-h9k-vbbzw”中的容器“abc-job”正在等待启动:CreateContainerConfigError
错误:容器具有 运行AsNonRoot,图像将 运行 作为根(pod:“abc-job-manual-h9k-xyz-ns-nonprod(e38ece94-b411-4d70-bc29 -3711f36cfe45)", 容器: abc-cron-job)
下图来自广告连播详情中的cluser
下面是我的 cronjob 的 yaml 文件
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-cron-job
spec:
schedule: "10 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: abc-cron-job
image: docker.repo1.jkl.com/xyz-services/abc/REPLACE_ME
imagePullPolicy: Always
env:
- name: spring-profile
valueFrom:
configMapKeyRef:
name: spring-profile
key: ENV
restartPolicy: OnFailure
在 yaml 文件中,缺少 securityContext,我添加了它,现在它工作正常。下面一个是更新后的yaml文件
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-cron-job
spec:
schedule: "10 * * * *"
jobTemplate:
spec:
template:
spec:
securityContext:
runAsGroup: 3000
runAsUser: 3000
containers:
- name: abc-cron-job
image: docker.repo1.xyz.com/abc-services/abc-application/REPLACE_ME
imagePullPolicy: Always
env:
- name: spring-profile
valueFrom:
configMapKeyRef:
name: spring-profile
key: ENV
securityContext:
privileged: false
restartPolicy: OnFailure
pod“abc-job-manual-h9k-vbbzw”中的容器“abc-job”正在等待启动:CreateContainerConfigError
错误:容器具有 运行AsNonRoot,图像将 运行 作为根(pod:“abc-job-manual-h9k-xyz-ns-nonprod(e38ece94-b411-4d70-bc29 -3711f36cfe45)", 容器: abc-cron-job)
下图来自广告连播详情中的cluser
下面是我的 cronjob 的 yaml 文件
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-cron-job
spec:
schedule: "10 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: abc-cron-job
image: docker.repo1.jkl.com/xyz-services/abc/REPLACE_ME
imagePullPolicy: Always
env:
- name: spring-profile
valueFrom:
configMapKeyRef:
name: spring-profile
key: ENV
restartPolicy: OnFailure
在 yaml 文件中,缺少 securityContext,我添加了它,现在它工作正常。下面一个是更新后的yaml文件
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-cron-job
spec:
schedule: "10 * * * *"
jobTemplate:
spec:
template:
spec:
securityContext:
runAsGroup: 3000
runAsUser: 3000
containers:
- name: abc-cron-job
image: docker.repo1.xyz.com/abc-services/abc-application/REPLACE_ME
imagePullPolicy: Always
env:
- name: spring-profile
valueFrom:
configMapKeyRef:
name: spring-profile
key: ENV
securityContext:
privileged: false
restartPolicy: OnFailure