Start an interactive bash prompt in Kubernetes with custom pod options Start an interactive bash prompt in Kubernetes with custom pod options kubernetes kubernetes

Start an interactive bash prompt in Kubernetes with custom pod options


Add --overrides='{ "spec": { "hostAliases": [ { "ip": "8.8.8.8", "hostnames": [ "dns.google" ] } ] } }' to the kubectl run command:

kubectl run my-shell --rm -i --tty --image ubuntu --overrides='{ "spec": { "hostAliases": [ { "ip": "8.8.8.8", "hostnames": [ "dns.google" ] } ] } }' -- bash

Reference: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run