首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让EKS kick与CircleCI协同工作?

如何让EKS kick与CircleCI协同工作?
EN

Stack Overflow用户
提问于 2021-09-24 20:59:43
回答 1查看 163关注 0票数 1

我可以将图像推送到ECR,但我甚至不确定下一步应该做什么(应该是什么流程)才能使我的图像在EKS上的Kubernetes上运行

代码语言:javascript
复制
jobs:
  create-deployment:
    executor: aws-eks/python3
    parameters:
      cluster-name:
        description: |
          Name of the EKS cluster
        type: string
    steps:
      - checkout
      - aws-eks/update-kubeconfig-with-authenticator:
          cluster-name: << parameters.cluster-name >>
          install-kubectl: true
      - kubernetes/create-or-update-resource:
          get-rollout-status: true
          resource-file-path: tests/nginx-deployment/deployment.yaml
          # resource-file-path: configs/k8s/prod-deployment.yaml
          resource-name: deployment/prod-deployment
orbs:
  aws-ecr: circleci/aws-ecr@6.15.0
  aws-eks: circleci/aws-eks@1.1.0
  kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
  deployment:
    jobs:
      - aws-ecr/build-and-push-image:
            repo: bwtc-backend
            tag: "${CIRCLE_BRANCH}-v0.1.${CIRCLE_BUILD_NUM}"
            dockerfile: configs/Docker/Dockerfile.prod
            path: .
            filters:
              branches:
                ignore:
                  - master
      - aws-eks/create-cluster:
          cluster-name: eks-demo-deployment
          requires:
            - aws-ecr/build-and-push-image
      - create-deployment:
          cluster-name: eks-demo-deployment
          requires:
            - aws-eks/create-cluster
      - aws-eks/update-container-image:
          cluster-name: eks-demo-deployment
          container-image-updates: 'nginx=nginx:1.9.1'
          post-steps:
            - kubernetes/delete-resource:
                resource-names: nginx-deployment
                resource-types: deployment
                wait: true
          record: true
          requires:
            - create-deployment
          resource-name: deployment/nginx-deployment
      - aws-eks/delete-cluster:
          cluster-name: eks-demo-deployment
          requires:
            - aws-eks/update-container-image

这就是我目前在配置中的配置。

我现在面对的问题是:

代码语言:javascript
复制
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Exited with code exit status 2
CircleCI received exit code 2

我使用的是CircleCI文档中的一个片段,所以我想它应该可以工作。我传入了我所能看到的所有参数,但我不能得到我在这里错过的东西。

我需要你们的帮助!

EN

回答 1

Stack Overflow用户

发布于 2021-11-15 20:53:04

上一次更新有一个bug。由于URL不正确而失败。这个问题仍然悬而未决,请参阅here。正确的url应该是

https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz

不同于当前

"https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz“

在等待审批期间,请先使用以下命令安装eksctl。

代码语言:javascript
复制
 - run:
      name: Install the eksctl tool
      command: |
        if which eksctl > /dev/null; then
          echo "eksctl is already installed"
          exit 0
        fi
        mkdir -p eksctl_download
        curl --silent --location --retry 5 "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" \
          | tar xz -C eksctl_download
        chmod +x eksctl_download/eksctl
        SUDO=""
        if [ $(id -u) -ne 0 ] && which sudo > /dev/null ; then
          SUDO="sudo"
        fi
        $SUDO mv eksctl_download/eksctl /usr/local/bin/
        rmdir eksctl_download

然后运行该作业

代码语言:javascript
复制
- aws-eks/create-cluster:
          cluster-name: eks-demo-deployment

这应该可以解决问题。一个例子

代码语言:javascript
复制
 # Creation of Cluster        
  create-cluster:
    executor: aws-eks/python3
    parameters:
      cluster-name:
        description: |
          Name of the EKS cluster
        type: string
        
    steps:
      - run:
          name: Install the eksctl tool
          command: |
            if which eksctl > /dev/null; then
              echo "eksctl is already installed"
              exit 0
            fi
            mkdir -p eksctl_download
            curl --silent --location --retry 5 "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" \
              | tar xz -C eksctl_download
            chmod +x eksctl_download/eksctl
            SUDO=""
            if [ $(id -u) -ne 0 ] && which sudo > /dev/null ; then
              SUDO="sudo"
            fi
            $SUDO mv eksctl_download/eksctl /usr/local/bin/
            rmdir eksctl_download
      
      - aws-eks/create-cluster:
          cluster-name: eks-demo-deployment
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69321039

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档