<p>I am facing an error while deploying deployment in CircleCI. Please find the configuration file below.</p>
<p>When running the kubectl CLI, we got an error between kubectl and the <a href="https://aws.amazon.com/eks/" rel="noreferrer">EKS</a> tool of the <code>aws-cli</code>.</p>
<pre class="lang-yaml prettyprint-override"><code>version: 2.1
orbs:
  aws-ecr: circleci/aws-ecr@6.3.0
  docker: circleci/docker@0.5.18
  rollbar: rollbar/deploy@1.0.1
  kubernetes: circleci/kubernetes@1.3.0
  deploy:
    version: 2.1
    orbs:
      aws-eks: circleci/aws-eks@1.0.0
      kubernetes: circleci/kubernetes@1.3.0
    executors:
      default:
        description: |
          The version of the circleci/buildpack-deps Docker container to use
          when running commands.
        parameters:
          buildpack-tag:
            type: string
            default: buster
        docker:
          - image: circleci/buildpack-deps:&lt;&lt;parameters.buildpack-tag&gt;&gt;
    description: |
      A collection of tools to deploy changes to AWS EKS in a declarative
      manner where all changes to templates are checked into version control
      before applying them to an EKS cluster.
    commands:
      setup:
        description: |
          Install the gettext-base package into the executor to be able to run
          envsubst for replacing values in template files.
          This command is a prerequisite for all other commands and should not
          have to be run manually.
        parameters:
          cluster-name:
            default: ''
            description: Name of the EKS Cluster.
            type: string
          aws-region:
            default: 'eu-central-1'
            description: Region where the EKS Cluster is located.
            type: string
          git-user-email:
            default: &quot;deploy@mail.com&quot;
            description: Email of the git user to use for making commits
            type: string
          git-user-name:
            default: &quot;CircleCI Deploy Orb&quot;
            description:  Name of the git user to use for making commits
            type: string
        steps:
          - run:
              name: install gettext-base
              command: |
                if which envsubst &gt; /dev/null; then
                  echo &quot;envsubst is already installed&quot;
                  exit 0
                fi
                sudo apt-get update
                sudo apt-get install -y gettext-base
          - run:
              name: Setup GitHub access
              command: |
                mkdir -p ~/.ssh
                echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' &gt;&gt; ~/.ssh/known_hosts
                git config --global user.email &quot;&lt;&lt; parameters.git-user-email &gt;&gt;&quot;
                git config --global user.name &quot;&lt;&lt; parameters.git-user-name &gt;&gt;&quot;
          - aws-eks/update-kubeconfig-with-authenticator:
              aws-region: &lt;&lt; parameters.aws-region &gt;&gt;
              cluster-name: &lt;&lt; parameters.cluster-name &gt;&gt;
              install-kubectl: true
              authenticator-release-tag: v0.5.1
      update-image:
        description: |
          Generates template files with the specified version tag for the image
          to be updated and subsequently applies that template after checking it
          back into version control.
        parameters:
          cluster-name:
            default: ''
            description: Name of the EKS Cluster.
            type: string
          aws-region:
            default: 'eu-central-1'
            description: Region where the EKS Cluster is located.
            type: string
          image-tag:
            default: ''
            description: |
              The tag of the image, defaults to the  value of `CIRCLE_SHA1`
              if not provided.
            type: string
          replicas:
            default: 3
            description: |
              The replica count for the deployment.
            type: integer
          environment:
            default: 'production'
            description: |
              The environment/stage where the template will be applied. Defaults
              to `production`.
            type: string
          template-file-path:
            default: ''
            description: |
              The path to the source template which contains the placeholders
              for the image-tag.
            type: string
          resource-name:
            default: ''
            description: |
              Resource name in the format TYPE/NAME e.g. deployment/nginx.
            type: string
          template-repository:
            default: ''
            description: |
              The fullpath to the repository where templates reside. Write
              access is required to commit generated templates.
            type: string
          template-folder:
            default: 'templates'
            description: |
              The name of the folder where the template-repository is cloned to.
            type: string
          placeholder-name:
            default: IMAGE_TAG
            description: |
              The name of the placeholder environment variable that is to be
              substituted with the image-tag parameter.
            type: string
          cluster-namespace:
            default: sayway
            description: |
              Namespace within the EKS Cluster.
            type: string
        steps:
          - setup:
              aws-region: &lt;&lt; parameters.aws-region &gt;&gt;
              cluster-name: &lt;&lt; parameters.cluster-name &gt;&gt;
              git-user-email: dev@sayway.com
              git-user-name: deploy
          - run:
              name: pull template repository
              command: |
                [ &quot;$(ls -A &lt;&lt; parameters.template-folder &gt;&gt;)&quot; ] &amp;&amp; \
                  cd &lt;&lt; parameters.template-folder &gt;&gt; &amp;&amp; git pull --force &amp;&amp; cd ..
                [ &quot;$(ls -A &lt;&lt; parameters.template-folder &gt;&gt;)&quot; ] || \
                  git clone &lt;&lt; parameters.template-repository &gt;&gt; &lt;&lt; parameters.template-folder &gt;&gt;
          - run:
              name: generate and commit template files
              command: |
                cd &lt;&lt; parameters.template-folder &gt;&gt;
                IMAGE_TAG=&quot;&lt;&lt; parameters.image-tag &gt;&gt;&quot;
                ./bin/generate.sh --file &lt;&lt; parameters.template-file-path &gt;&gt; \
                  --stage &lt;&lt; parameters.environment &gt;&gt; \
                  --commit-message &quot;Update &lt;&lt; parameters.template-file-path &gt;&gt; for &lt;&lt; parameters.environment &gt;&gt; with tag ${IMAGE_TAG:-$CIRCLE_SHA1}&quot; \
                  &lt;&lt; parameters.placeholder-name &gt;&gt;=&quot;${IMAGE_TAG:-$CIRCLE_SHA1}&quot; \
                  REPLICAS=&lt;&lt; parameters.replicas &gt;&gt;
          - kubernetes/create-or-update-resource:
              get-rollout-status: true
              namespace: &lt;&lt; parameters.cluster-namespace &gt;&gt;
              resource-file-path: &lt;&lt; parameters.template-folder &gt;&gt;/&lt;&lt; parameters.environment &gt;&gt;/&lt;&lt; parameters.template-file-path &gt;&gt;
              resource-name: &lt;&lt; parameters.resource-name &gt;&gt;
jobs:
  test:
    working_directory: ~/say-way/core
    parallelism: 1
    shell: /bin/bash --login
    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
      KONFIG_CITUS__HOST: localhost
      KONFIG_CITUS__USER: postgres
      KONFIG_CITUS__DATABASE: sayway_test
      KONFIG_CITUS__PASSWORD: &quot;&quot;
      KONFIG_SPEC_REPORTER: true
    docker:
    - image: 567567013174.dkr.ecr.eu-central-1.amazonaws.com/core-ci:test-latest
      aws_auth:
        aws_access_key_id: $AWS_ACCESS_KEY_ID_STAGING
        aws_secret_access_key: $AWS_SECRET_ACCESS_KEY_STAGING
    - image: circleci/redis
    - image: rabbitmq:3.7.7
    - image: circleci/mongo:4.2
    - image: circleci/postgres:10.5-alpine
    steps:
    - checkout
    - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
    # This is based on your 1.0 configuration file or project settings
    - restore_cache:
        keys:
        - v1-dep-{{ checksum &quot;Gemfile.lock&quot; }}-
        # any recent Gemfile.lock
        - v1-dep-
    - run:
        name: install correct bundler version
        command: |
          export BUNDLER_VERSION=&quot;$(grep -A1 'BUNDLED WITH' Gemfile.lock | tail -n1 | tr -d ' ')&quot;
          echo &quot;export BUNDLER_VERSION=$BUNDLER_VERSION&quot; &gt;&gt; $BASH_ENV
          gem install bundler --version $BUNDLER_VERSION
    - run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3'
    - run:
        name: copy test.yml.sample to test.yml
        command: cp config/test.yml.sample config/test.yml
    - run:
        name: Precompile and clean assets
        command: bundle exec rake assets:precompile assets:clean
    # Save dependency cache
    - save_cache:
        key: v1-dep-{{ checksum &quot;Gemfile.lock&quot; }}-{{ epoch }}
        paths:
        - vendor/bundle
        - public/assets
    - run:
        name: Audit bundle for known security vulnerabilities
        command: bundle exec bundle-audit check --update
    - run:
        name: Setup Database
        command: bundle exec ruby ~/sayway/setup_test_db.rb
    - run:
        name: Migrate Database
        command: bundle exec rake db:citus:migrate
    - run:
        name: Run tests
        command: bundle exec rails test -f
    # By default, running &quot;rails test&quot; won't run system tests.
    - run:
        name: Run system tests
        command: bundle exec rails test:system
    # Save test results
    - store_test_results:
        path: /tmp/circleci-test-results
    # Save artifacts
    - store_artifacts:
        path: /tmp/circleci-artifacts
    - store_artifacts:
        path: /tmp/circleci-test-results
  build-and-push-image:
    working_directory: ~/say-way/
    parallelism: 1
    shell: /bin/bash --login
    executor: aws-ecr/default
    steps:
      - checkout
      - run:
          name: Pull latest core images for cache
          command: |
            $(aws ecr get-login --no-include-email --region $AWS_REGION)
            docker pull &quot;${AWS_ECR_ACCOUNT_URL}/core:latest&quot;
      - docker/build:
          image: core
          registry: &quot;${AWS_ECR_ACCOUNT_URL}&quot;
          tag: &quot;latest,${CIRCLE_SHA1}&quot;
          cache_from: &quot;${AWS_ECR_ACCOUNT_URL}/core:latest&quot;
      - aws-ecr/push-image:
          repo: core
          tag: &quot;latest,${CIRCLE_SHA1}&quot;
  deploy-production:
    working_directory: ~/say-way/
    parallelism: 1
    shell: /bin/bash --login
    executor: deploy/default
    steps:
      - kubernetes/install-kubectl:
          kubectl-version: v1.22.0
      - rollbar/notify_deploy_started:
          environment: report
      - deploy/update-image:
          resource-name: deployment/core-web
          template-file-path: core-web-pod.yml
          cluster-name: report
          environment: report
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 3
      - deploy/update-image:
          resource-name: deployment/core-worker
          template-file-path: core-worker-pod.yml
          cluster-name: report
          environment: report
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 4
      - deploy/update-image:
          resource-name: deployment/core-worker-batch
          template-file-path: core-worker-batch-pod.yml
          cluster-name: report
          environment: report
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 1
      - rollbar/notify_deploy_finished:
          deploy_id: &quot;${ROLLBAR_DEPLOY_ID}&quot;
          status: succeeded
  deploy-demo:
    working_directory: ~/say-way/
    parallelism: 1
    shell: /bin/bash --login
    executor: deploy/default
    steps:
      - kubernetes/install-kubectl:
          kubectl-version: v1.22.0
      - rollbar/notify_deploy_started:
          environment: demo
      - deploy/update-image:
          resource-name: deployment/core-web
          template-file-path: core-web-pod.yml
          cluster-name: demo
          environment: demo
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 2
      - deploy/update-image:
          resource-name: deployment/core-worker
          template-file-path: core-worker-pod.yml
          cluster-name: demo
          environment: demo
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 1
      - deploy/update-image:
          resource-name: deployment/core-worker-batch
          template-file-path: core-worker-batch-pod.yml
          cluster-name: demo
          environment: demo
          template-repository: git@github.com:say-way/sw-k8s.git
          replicas: 1
      - rollbar/notify_deploy_finished:
          deploy_id: &quot;${ROLLBAR_DEPLOY_ID}&quot;
          status: succeeded
workflows:
  version: 2.1
  build-n-test:
    jobs:
      - test:
          filters:
            branches:
              ignore: master
  build-approve-deploy:
    jobs:
      - build-and-push-image:
          context: Core
          filters:
            branches:
              only: master
      - approve-report-deploy:
          type: approval
          requires:
            - build-and-push-image
      - approve-demo-deploy:
          type: approval
          requires:
            - build-and-push-image
      - deploy-production:
          context: Core
          requires:
            - approve-report-deploy
      - deploy-demo:
          context: Core
          requires:
            - approve-demo-deploy
</code></pre>

<p>There is <a href="https://github.com/aws/aws-cli/issues/6920" rel="nofollow noreferrer">an issue</a> in aws-cli. It is already fixed.</p>
<hr />
<p>In <em>my</em> case, updating aws-cli + updating the ~/.kube/config helped.</p>
<ol>
<li>Update aws-cli (<a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="nofollow noreferrer">following the documentation</a>)</li>
</ol>
<pre><code>curl &quot;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&quot; -o &quot;awscliv2.zip&quot;
unzip awscliv2.zip
sudo ./aws/install --update
</code></pre>
<ol start="2">
<li>Update the kube configuration</li>
</ol>
<pre><code>mv ~/.kube/config ~/.kube/config.bk
aws eks update-kubeconfig --region ${AWS_REGION}  --name ${EKS_CLUSTER_NAME}
</code></pre>
