helm icon indicating copy to clipboard operation
helm copied to clipboard

Deploying to EKS, need credentials passed

Open tdonovic opened this issue 5 years ago • 8 comments

Hi there, I am attempting to deploy some helm chart to my EKS cluster. In order to do that, I believe I have configured aws-iam-authenticator properly, since I get the following log:

helm upgrade seed-java helm/seed-java --install --wait --atomic --namespace=feat-SYS-1027-CD-core-dev --set=app.name=seed-java --values=./values.yml
could not get token: NoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors

Which is created by:

 51          uses: 'deliverybot/helm@master'
 52          with:
 53            namespace: ${{ steps.helmvars.outputs.namespace}}
 54            chart: ${{steps.helmvars.outputs.chart}}
 55            token: ${{ github.token }}
 56            value_files: "[ ${{steps.helmvars.outputs.values_static}}, ${{steps.helmvars.outputs.values_ns}}]"
 57            helm: 'helm'
 58            release: ${{ steps.helmvars.outputs.release }}
 59          env:
 60            KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'

Does this mean that the AWS_ACCESS_KEY_ID etc are not being properly passed into the container that is being executed? I am at a bit of a loss.

I know that the credentials work, and are available to prior steps in the workflow, since I push the containers I seek to deploy to ECR.

Any ideas?

Thanks!

tdonovic avatar Feb 19 '20 11:02 tdonovic

@tdonovic you are using helm3 or helmv2x?

raj-shekhar1 avatar Feb 19 '20 11:02 raj-shekhar1

Yep I believe that the credentials are not being passed in, what I think you need is the following:

 51          uses: 'deliverybot/helm@master'
 52          with:
 53            namespace: ${{ steps.helmvars.outputs.namespace}}
 54            chart: ${{steps.helmvars.outputs.chart}}
 55            token: ${{ github.token }}
 56            value_files: "[ ${{steps.helmvars.outputs.values_static}}, ${{steps.helmvars.outputs.values_ns}}]"
 57            helm: 'helm'
 58            release: ${{ steps.helmvars.outputs.release }}
 59          env:
 60            KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
 +++           AWS_ACCESS_KEY_ID: '${{ secrets.MY_KEY }}'
 +++           AWS_SECRET_ACCESS_KEY: '${{ secrets.MY_KEY }}'

colinjfw avatar Feb 19 '20 18:02 colinjfw

@raj-shekhar1 I am running helm 2.x @colinjfw good point, I have tried this and see the same issue. I know that the creds are good, since I use them to push to ECR.

 50        - name: Helm Deploy
 51          uses: 'deliverybot/helm@master'
 52          with:
 53            namespace: ${{ steps.helmvars.outputs.namespace}}
 54            chart: ${{steps.helmvars.outputs.chart}}
 55            token: ${{ github.token }}
 56            value_files: "[ ${{steps.helmvars.outputs.values_static}}, ${{steps.helmvars.outputs.values_ns}}]"
 57            helm: 'helm'
 58            release: ${{ steps.helmvars.outputs.release }}
 59          env:
 60            KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
 61            AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
 62            AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'

But I still get the same error:

could not get token: NoCredentialProviders: no valid providers in chain. Deprecated.

This is my first GH Actions project, should I expect more than just -e in -e AWS_ACCESS_KEY_ID? Because it looks like it passes the key, but does not pass the value? Or is this how it is rendered in the logs?

/usr/bin/docker run --name e87b52c1ffebf5b3a1429c9170f5fb8ee69444_a7c540 --label e87b52 --workdir /github/workspace --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e KUBECONFIG_FILE -e INPUT_NAMESPACE -e INPUT_CHART -e INPUT_TOKEN -e INPUT_VALUE_FILES -e INPUT_HELM -e INPUT_RELEASE -e INPUT_VALUES -e INPUT_DRY-RUN -e INPUT_VALUE-FILES -e INPUT_SECRETS -e INPUT_VERSION -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/seed-java/seed-java":"/github/workspace" e87b52:c1ffebf5b3a1429c9170f5fb8ee69444

tdonovic avatar Feb 19 '20 23:02 tdonovic

Hmm, I really don't know at this point. I haven't actually used this action myself with ecr. Maybe someone else can chime in?

I think the answer to the second question is that yes it is just how it's being rendered in the logs.

colinjfw avatar Feb 20 '20 00:02 colinjfw

Really appreciate your help. Tried to dig a bit futher into how env vars are handled, but there is a bit of a lack of detail in the docs, or I'm not looking in the right place. I think the next step is for me to try to get the creds working inside some other container, then make the changes to how this container is being called to match, and work. If its not me missing the point, that is

tdonovic avatar Feb 20 '20 04:02 tdonovic

We are facing a similar issue, it seems that the Docker image should include the aws-cli so it can execute the get-token within the kubeconfig. I am going to experiment in my own fork, will update here if it works and word with the maintainer to see if we can create another version of this action with support for EKS.

rvichery avatar Apr 01 '20 21:04 rvichery

We are facing a similar issue, it seems that the Docker image should include the aws-cli so it can execute the get-token within the kubeconfig. I am going to experiment in my own fork, will update here if it works and word with the maintainer to see if we can create another version of this action with support for EKS.

if you post the link to the fork I'm happy to help test

aheifetz avatar Apr 02 '20 00:04 aheifetz

@aheifetz the PR has been merged to master. So you should be able to test directly from this repository.

rvichery avatar Apr 02 '20 15:04 rvichery