Skip to content

Instantly share code, notes, and snippets.

Last active August 11, 2016 20:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# Expects `kubernetes_api_endpoint` as `--extra-vars "kubernetes_api_endpoint=xxxx"`
- hosts:
connection: local
- name: Set kubectl endpoint
shell: "kubectl config set-cluster {{ cluster_name }} --certificate-authority={{ playbook_dir }}/../cert/ca.pem --embed-certs=true --server=https://{{ kubernetes_api_endpoint }}:6443"
- name: Set kubectl credentials
shell: "kubectl config set-credentials {{ user }} --token {{ token }}"
- name: Set kubectl default context
shell: "kubectl config set-context default-context --cluster={{ cluster_name }} --user={{ user }}"
- name: Switch kubectl to default context
shell: "kubectl config use-context default-context"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment