gpt4 book ai didi

kubernetes - 由于验证错误,无法使用kubectl创建作业

转载 作者:行者123 更新时间:2023-12-02 12:01:46 27 4
gpt4 key购买 nike

小组,我正在尝试使用job.yaml创建一个 secret ,但由于验证错误而导致失败。谁能看看。谢谢。

我也附上我的Yaml和输出。

▶ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:18:23Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"d2835416544f298c919e2ead3be3d0864b52323b", GitTreeState:"clean", BuildDate:"2018-02-07T11:55:20Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
dtlu @ dtlu16 ~/kops/deployments/


└─ $ ▶ kubectl create -f ~/backup/hp-job.yaml
error: error validating "/home/user/backup/hp-job.yaml": error validating data: [ValidationError(Job): unknown field "backoffLimit" in io.k8s.api.batch.v1.Job, ValidationError(Job): unknown field "labels" in io.k8s.api.batch.v1.Job, ValidationError(Job): unknown field "name" in io.k8s.api.batch.v1.Job, ValidationError(Job): unknown field "namespace" in io.k8s.api.batch.v1.Job, ValidationError(Job): unknown field "template" in io.k8s.api.batch.v1.Job]; if you choose to ignore these errors, turn validation off with --validate=false

我的job.yaml是

---
apiVersion: batch/v1
backoffLimit: 4
kind: Job
labels:
  release: testportal
metadata:
name: testportal-certutil
namespace: test-portal
spec:
template:
  metadata:
    labels:
      release: testportal
  spec:
    containers:
      -
        command:
          - /bin/k8sutils
          - cert
          - create
          - "--namespace"
          - test-portal
          - "--secret"
          - testportal
          - "--force"
        image: "account.dkr.ecr.us-west-1.amazonaws.com/test/platform/k8sutils:053aae617ecff8aaf986f465f491ad1d8bb7e78c"
        imagePullPolicy: Always
        name: testportal-certutil
    restartPolicy: Never
    serviceAccount: testportal-certutil

最佳答案

通过解决语法和对齐方式来解决


---
apiVersion: batch/v1
kind: Job
metadata:
  labels:
    release: testportal
  name: testportal-certutil
  namespace: test-portal
spec:
  backoffLimit: 4
  template:
    metadata:
      labels:
        release: testportal
    spec:
      containers:
        -
          command:
            - /bin/k8sutils
            - cert
            - create
            - "--namespace"
            - test-portal
            - "--secret"
            - testportal
            - "--force"
          image: “account.dkr.ecr.us-west-1.amazonaws.com/team/platform/k8sutils:053aae617ecff8aaf986f465f491ad1d8bb7e78c"
          imagePullPolicy: Always
          name: team-certutil
      restartPolicy: Never
      serviceAccount: team-certutil

关于kubernetes - 由于验证错误,无法使用kubectl创建作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60627738/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com