CircleCI 运行 删除 k8s 资源失败

CircleCI run failed on delete k8s resource

我有 CircleCI 设置并且 运行 正常,它会帮助我创建部署。今天由于与kubernetes相关的错误,我在创建部署的步骤中突然遇到问题。

我让 config.yml 跟随 https://circleci.com/developer/orbs/orb/circleci/kubernetes

的文档

这是我在配置文件中的设置版本:

version: 2.1

orbs: 
  kube-orb: circleci/kubernetes@1.3.0

commands:
  docker-check:
    steps: 
      - docker/check:
        docker-username: MY_USERNAME
        docker-password: MY_PASS
        registry: $DOCKER_REGISTRY

jobs: 
  create-deployment:
    executor: aws-eks/python3
    parameters: 
      cluster-name:
        description: Name of the EKS cluster
        type: string
    steps:
      - checkout
      # It failed on this step
      - kube-orb/delete-resource:
        now: true
        resource-names: my-frontend-deployment
        resource-types: deployments
        wait: true

下面是错误日志的副本

#!/bin/bash -eo pipefail
#!/bin/bash
RESOURCE_FILE_PATH=$(eval echo "$PARAM_RESOURCE_FILE_PATH")
RESOURCE_TYPES=$(eval echo "$PARAM_RESOURCE_TYPES")
RESOURCE_NAMES=$(eval echo "$PARAM_RESOURCE_NAMES")
LABEL_SELECTOR=$(eval echo "$PARAM_LABEL_SELECTOR")
ALL=$(eval echo "$PARAM_ALL")
CASCADE=$(eval echo "$PARAM_CASCADE")
FORCE=$(eval echo "$PARAM_FORCE")
GRACE_PERIOD=$(eval echo "$PARAM_GRACE_PERIOD")
IGNORE_NOT_FOUND=$(eval echo "$PARAM_IGNORE_NOT_FOUND")
NOW=$(eval echo "$PARAM_NOW")
WAIT=$(eval echo "$PARAM_WAIT")
NAMESPACE=$(eval echo "$PARAM_NAMESPACE")
DRY_RUN=$(eval echo "$PARAM_DRY_RUN")
KUSTOMIZE=$(eval echo "$PARAM_KUSTOMIZE")
if [ -n "${RESOURCE_FILE_PATH}" ]; then
    if [ "${KUSTOMIZE}" == "1" ]; then
    set -- "$@" -k
    else
    set -- "$@" -f
    fi
    set -- "$@" "${RESOURCE_FILE_PATH}"
elif [ -n "${RESOURCE_TYPES}" ]; then
    set -- "$@" "${RESOURCE_TYPES}"
    if [ -n "${RESOURCE_NAMES}" ]; then
    set -- "$@" "${RESOURCE_NAMES}"
    elif [ -n "${LABEL_SELECTOR}" ]; then
    set -- "$@" -l
    set -- "$@" "${LABEL_SELECTOR}"
    fi
fi
if [ "${ALL}" == "true" ]; then
    set -- "$@" --all=true
fi
if [ "${FORCE}" == "true" ]; then
    set -- "$@" --force=true
fi
if [ "${GRACE_PERIOD}" != "-1" ]; then
    set -- "$@" --grace-period="${GRACE_PERIOD}"
fi
if [ "${IGNORE_NOT_FOUND}" == "true" ]; then
    set -- "$@" --ignore-not-found=true
fi
if [ "${NOW}" == "true" ]; then
    set -- "$@" --now=true
fi
if [ -n "${NAMESPACE}" ]; then
    set -- "$@" --namespace="${NAMESPACE}"
fi
if [ -n "${DRY_RUN}" ]; then
    set -- "$@" --dry-run="${DRY_RUN}"
fi
set -- "$@" --wait="${WAIT}"
set -- "$@" --cascade="${CASCADE}"
if [ "$SHOW_EKSCTL_COMMAND" == "1" ]; then
    set -x
fi
kubectl delete "$@"
if [ "$SHOW_EKSCTL_COMMAND" == "1" ]; then
    set +x
fi

error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

Exited with code exit status 1
CircleCI received exit code 1

有人知道它有什么问题吗?我不确定问题是发生在 Circle CI 端还是 Kubernetes 端。

从昨天早上(16 小时前)开始,我就面临着同样的问题。然后采纳@Gavy 的建议,我只是在 config.yml:

中添加了这个
steps:
  - checkout
  # !!! HERE !!!
  - kubernetes/install-kubectl:
      kubectl-version: v1.23.5
  - run:

现在可以了。希望对你有帮助。