在Jenkins中使用kubectl应用“ deployment.yaml”时出错

时间:2019-10-09 07:34:04

标签: jenkins-pipeline kubectl

我正在尝试使用Jenkins来应用以下deployment.yaml,这给了我错误提示

error: unable to recognize "deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"

但是当我直接在linux服务器内部使用相同的功能时,它就成功了。

kubectl版本:

    Client Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.8-eks-cd3eb0", GitCommit:"cd3eb06a896644a770b14acf6b3123b417fa50e9", GitTreeState:"clean", BuildDate:"2019-07-31T00:59:16Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.10-eks-825e5d", GitCommit:"825e5de08cb05714f9b224cd6c47d9514df1d1a7", GitTreeState:"clean", BuildDate:"2019-08-18T03:58:32Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

Deployemnt.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
      name: {{APP_NAME}}
  name: {{APP_NAME}}
spec:
  selector:
    matchLabels:
      run: {{APP_NAME}}
  replicas: 1
  template:
    metadata:
      labels:
        name: {{APP_NAME}}
        run: {{APP_NAME}}
    spec:
      containers:
      - name: {{APP_NAME}}
        image: xxxxxxxxxxx.ecr.us-east-1.amazonaws.com/xxxxxxx/xxxxxxx:{{IMAGE_ID}}
        ports:
        - containerPort: 80

您能帮我解决这个问题吗?

0 个答案:

没有答案