Skip to content

Instantly share code, notes, and snippets.

@tanelmae
Last active June 3, 2022 10:48
Show Gist options
  • Save tanelmae/ac3b9c9fb8ecf801b009eb21d2040c3e to your computer and use it in GitHub Desktop.
Save tanelmae/ac3b9c9fb8ecf801b009eb21d2040c3e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# When you really need kubeconfig file inside the pod
cat << EOF
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: $(base64 -w 0 /var/run/secrets/kubernetes.io/serviceaccount/ca.crt)
server: https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT
name: local
contexts:
- context:
cluster: local
user: local
name: local
current-context: local
kind: Config
preferences: {}
users:
- name: local
user:
token: $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment