美文网首页
在bitbucket配置ali k8s pipeline

在bitbucket配置ali k8s pipeline

作者: michael_0x | 来源:发表于2023-03-07 11:35 被阅读0次
    mage: atlassian/default-image:3
    definitions:
      services:
        docker:
          memory: 1024
      steps:
        - step: &debug
            services:
              - docker
            name: ' debug pipeline'
            script:
              - echo $KUBE_CONFIG_DEV | base64 -d > kubeconfig-dev
              - export KUBECONFIG=kubeconfig-dev
              - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
              - chmod +x ./kubectl
              - mv ./kubectl /usr/local/bin/kubectl
              - kubectl version --client
              - kubectl get ns
    pipelines:
      branches:
        dev:
          - step: *debug
    

    注意这里的$KUBE_CONFIG_DEV变量,要到阿里的k8s->集群信息->连接信息->公网访问里面,点击复制,复制好kubectl连接的配置文件,然后粘贴到本地的一个空白文件里面(config.txt):


    image.png
    cat config.txt |base64 >./config.b64
    cat config.b64
    cat config.b64 |base64 -d
    

    验证OK后,直接将config.b64复制到bitbucket的环境变量里面:


    image.png

    相关文章

      网友评论

          本文标题:在bitbucket配置ali k8s pipeline

          本文链接:https://www.haomeiwen.com/subject/cuzvldtx.html