Commit 55f03fe3 authored by Larkin Heintzman's avatar Larkin Heintzman

updated readme

parent 12a865da
...@@ -21,3 +21,56 @@ Then the tarball can be loaded into the docker registry, on the control plane no ...@@ -21,3 +21,56 @@ Then the tarball can be loaded into the docker registry, on the control plane no
Verify the image is in fact the correct architecture: Verify the image is in fact the correct architecture:
`docker image inspect <tag_name>` `docker image inspect <tag_name>`
## Cluster Setup
After the images are built, the next step is likely to bring up a cluster. The `clusterSetup.sh` script does this, with some assumptions about your application. The high level steps are as follows:
- turn off swap: `swapoff -a`
- start cluster, config is for pod subnet (may take time): `kubeadm init --config kubeadm-config.yml`
- move config over:
`mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config`
- apply flannel networking: `kubectl apply -f flannel.yml`
- remove taint from control plane: `kubectl taint nodes --all node-role.kubernetes.io/master-`
- label node(s) if deployment calls for it (ones in this repo do via `nodeSelector: <tag>=<value>` in the deployment): `kubectl label nodes <node_name> <tag=<value>`
- start applying deployments starting with master: `kubectl apply -f kubernetes/master-deployment.yml`
- continue applying deployments for as many as needed
- turn off cluster: `kubeadm reset` potentially followed by [clean-up][cleanupCluster]
[cleanupCluster]: [https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/]
## Handy Troubleshooting Commands
There are a number of non-intuitive kubernetes commands that are super helpful for specific tasks:
- drain a particular node so that it can be removed: `kubectl drain <node name> --delete-emptydir-data --force --ignore-daemonsets` then `kubectl delete node <node_name>`
- get bash terminal inside pod: `kubectl exec -it <pod_name> -- bash`
- get which pods are on which nodes (a travesty this one): `kubectl get pod -o=custom-columns=NAME:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeName --all-namespaces`
- another option to see pod location: `kubectl get pods --all-namespaces -o wide`
- regenerate token join command: `kubeadm token create --print-join-command`
## Links With More Information
Debugging clusters can be somewhat difficult as everything is stuffed into pods, the links below have some steps to try:
- if `CrashLoopBackoff` is thrown when running `kubectl get pods`, take a look [here][crashloop]
- general steps for building images with buildx [here][docker-buildx]
- there's some specific steps that got ARM64 builds working in my case, solution [here][docker-buildx-platform]
[crashloop]: https://managedkube.com/kubernetes/pod/failure/crashloopbackoff/k8sbot/troubleshooting/2019/02/12/pod-failure-crashloopbackoff.html
[docker-buildx]: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/
[docker-buildx-platform]: https://github.com/docker/buildx/issues/464
...@@ -2,4 +2,11 @@ ...@@ -2,4 +2,11 @@
# set -e # set -e
# script that starts up kubernetes cluster, and does some basic qol # script that starts up kubernetes cluster, and does some basic qol
swapoff -a # turn off swap memory
kubeadm init --config kubeadm-config.yml
mkdir -p ~/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
#tbd #tbd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment