Skip to content

Instantly share code, notes, and snippets.

@aramse
Last active February 8, 2023 07:12
Show Gist options
  • Save aramse/6eb4a5b11269bb19d9ad35bb21ace6f6 to your computer and use it in GitHub Desktop.
Save aramse/6eb4a5b11269bb19d9ad35bb21ace6f6 to your computer and use it in GitHub Desktop.
Useful kubectl commands
# Run a container with the AWS CLI on a specific node:
kubectl run -it debug --image amazon/aws-cli --command bash --overrides='{ "apiVersion": "apps/v1beta1", "spec": { "template": { "spec": { "nodeSelector": { "kubernetes.io/hostname": "<node-name>" } } } } }'
# Configure KIAM role:
kubectl run -it debug --image amazon/aws-cli --overrides='{"spec": {"template": {"metadata": {"annotations": {"iam.amazonaws.com/role": "my-cool-role"}}}}}' -- bash
@jmettes
Copy link

jmettes commented Oct 21, 2021

I came across this from Google. Here's a quick oneliner for testing if your service account (& IAM role) for your IRSA setup works

$ kubectl run --rm -it debug --image amazon/aws-cli --command bash --overrides='{ "spec": { "serviceAccount": "my-cool-service-account" }  }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment