kubernetes 错误:您必须登录到服务器(服务器已要求客户端提供凭据)n规范文件验证失败

ryevplcw  于 2023-08-03  发布在  Kubernetes
关注(0)|答案(1)|浏览(114)
step:
  name: "Deploy to prod environment"
  image: atlassian/default-image:2
  script:
    - source .env
    - envsubst < k8s/deploy.yaml > k8s/deploy-apply.yaml
    - cat k8s/deploy-apply.yaml
    - pipe: atlassian/aws-eks-kubectl-run:2.2.1
      variables:
        AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
        AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
        AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
        CLUSTER_NAME: $CLUSTER_NAME
        KUBECTL_COMMAND: "apply"
        RESOURCE_PATH: "k8s/deploy-apply.yaml"
        DEBUG: "true"

字符串
我已经检查了k8s/deploy-apply.yaml,当手动应用时,它运行成功,在替换下面的变量后,命令运行成功:

kubectl apply -f k8s/deploy-apply.yaml


但是在bitbucket-pipeline中运行时,我得到以下错误:

INFO: Successfully updated the kube config.
error: You must be logged in to the server (the server has asked for the client to provide credentials)
✖ spec file validation failed.


我已经检查了AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY,它们是有效的,有权限。

ut6juiuv

ut6juiuv1#

您确定此处引用的IAM用户是创建群集的用户吗?当你用根目录创建群集并尝试用IAM用户访问它时,可能会发生此错误。

相关问题