Skip to content

Instantly share code, notes, and snippets.

@O1ahmad
Last active July 22, 2021 04:01
Show Gist options
  • Save O1ahmad/33709aa3decfb5db921530120496a167 to your computer and use it in GitHub Desktop.
Save O1ahmad/33709aa3decfb5db921530120496a167 to your computer and use it in GitHub Desktop.
Kubernetes Cluster Setup Notes
1. Create kubespray image based on master repo
** NOTE: add iproute2 to dockerfile build
docker build -t kubespray:fix --network host . (from root of kubespray repo @ master)
2. Update Kubernetes inventory under <kubespray-root>/inventory/<cluster>/<hosts-file>
3. Execute containerized kubespray against host inventory with proper SSH key
docker run --network host --rm -it --mount type=bind,source="$(pwd)"/inventory/<inventory>,dst=/inventory \
--mount type=bind,source="${HOME}"/.ssh/id_rsa,dst=/root/.ssh/id_rsa \
<fixed-kubespray-image> ansible-playbook -i /inventory/<host-file> --private-key /root/.ssh/id_rsa cluster.yml --become --user <ssh-user>
* When updating k8s master node address:
1. update *supplementary_addresses_in_ssl_keys* in `inventory/group_vars/k8s_cluster/k8s-cluster.yml` with <new-ip-address>
2. remove old kubernetes certs: sudo rm /etc/kubernetes/ssl/apiserver.crt, sudo rm /etc/kubernetes/ssl/apiserver.key
3. (on reset) remove config and runtime DIRs: /etc/kubernetes, /usr/libexec/kubernetes, /var/lib/kubernetes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment