k8sviz
k8sviz copied to clipboard
Discuss whether AWS SDK needs to be bundled
In the line with #29
RUN apk add --no-cache \
python3 \
py3-pip \
&& pip3 install --upgrade pip \
&& pip3 install \
awscli \
&& rm -rf /var/cache/apk/*
@skaffille
Thank you for opening this issue.
Could you explain why AWS SDK will be needed, like how it is used in k8sviz for which purpose?
I bumped into this myself using the AWS auth method for EKS. Its a specific use case where proxies the user identity call through the aws cli. The error looks something like this:
Failed to get namespace "default": Get "https://my-cluster-id-string.us-east-1.eks.amazonaws.com/api/v1/namespaces/default": getting credentials: exec: exec: "aws": executable file not found in $PATH
Since the command executes in a container the container must have the aws cli installed in order to authn to the cluster.
You could work around this by creating a kube service account and generating a kubeconfig file that has the embedded token for authn in the file then passing it to the script as your kubeconfig file. I'm planning on trying this now.
@2tim
Thank you for your explanation. I didn't know this use case and very good to know it. I understand the documents for them are as follows:
I bumped into this myself using the AWS auth method for EKS. Its a specific use case where proxies the user identity call through the aws cli.
https://docs.aws.amazon.com/eks/latest/userguide/managing-auth.html
You could work around this by creating a kube service account and generating a kubeconfig file that has the embedded token for authn in the file then passing it to the script as your kubeconfig file.
https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
I'm planning on trying this now.
Thank you very much for working on it. I will wait for your report. Also, I will consider whether handling above use case directly will be good to go (I still need to understand the detail and need to check whether this kind of commands are allowed to be included in the container images and to be distributed publicly).
@skaffille @2tim
Created #44 to provide a way to include AWS SDK. Could you give feedback if it would be of help (and test if the image built with the command works well, if possible)?
Merged #44. I hope that below works for environments that requires AWS SDK:
$ DEVEL_IMAGE=mkimuram/k8sviz DEVEL_TAG=$(cat version.txt) TARGET=aws make image-build
And below works for Google cloud SDK:
$ DEVEL_IMAGE=mkimuram/k8sviz DEVEL_TAG=$(cat version.txt) TARGET=gcloud make image-build
@mkimuram i am going to try that and let you know thank you
@mkimuram Getting this error "Unable to locate credentials. You can configure credentials by running "aws configure". Failed to get namespace "default": Get "https://7*/default": getting credentials: exec: executable aws failed with exit code 255", though i have passed aws credentials to the docker image
May be need to have more parameters in shell script to add aws credentials
@Sreddy-gs Yes, Maybe something like below will be needed around here.
-v ~/.aws/config:/awsconfig:ro
-e AWS_CONFIG_FILE=/awsconfig
Could you try?
@mkimuram that worked :) thank you