kubee-cluster command
The kubee-cluster command manages the hosts of the clusters.
Command
Section titled “Command”play:
- Hardened the Operating System
- Operating System package upgrade
- Kubernetes installation
Os gets upgraded automatically on each node every 24 hours and reboot safely with the Kubernetes Reboot Daemon to performs safe automatic node reboots
UPGRADE
Section titled “UPGRADE”If you are on a vps, it’s a good time to do a snapshot.
upgrade will upgrade Kubernetes on your cluster if the k3s version is higher.
On a upgrade:
- if the kubee chart
kubernetes-monitoringis installed, you may get some alerting - the system pods will restart
- the cluster should become again healthy in a couple of minutes.
To avoid alerts, you need a cluster with a minimum 2 control plane/master node to maintain quorum when one goes down for upgrading.
You can automate it with the K3 system upgrade controller https://github.com/rancher/system-upgrade-controller
Metadata
Section titled “Metadata”K3s version
Section titled “K3s version”The k3s version can be specified:
- using an inventory file with the
k3s_versionvar - using the default kubee inventory file, the environment variable:
KUBEE_CLUSTER_K3S_TOKEN
The k3s versions are available at: https://github.com/k3s-io/k3s/releases
Example:
export KUBEE_CLUSTER_K3S_VERSION="v1.32.0+k3s1"The value is made up of:
v1.32is the version of Kubernetesk3s1is the version of thek3swrapper.
Copy KUBECONFIG and connection test
Section titled “Copy KUBECONFIG and connection test”# envexport KUBECONFIG=~/.kube/config.new# permissionchmod 600 "$KUBECONFIG"kubectl config use-context k3s-ansible# if on localhostkubectl config set-cluster k3s-ansible --server=https://127.0.0.1:6443kubectl config set-cluster k3s-ansible --server="https://$CLUSTER_API_SERVER_IP:6443"kubectl cluster-info # we should connect to the APIkubectl get nodes # we should see a nodehelm list -n kube-system# change server (IP for now because the FQDN should be set before installing kube)# otherwise `tls: failed to verify certificate: x509: certificate is valid for kube-test-server-01, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, localhost, not kube-test-server-01.xxx`kubectl config rename-context k3s-ansible $KUBEE_CLUSTER_NAME# testkubectl cluster-info dumpOther tests: https://technotim.live/posts/k3s-etcd-ansible/#testing-your-cluster
Dependencies
Section titled “Dependencies”yqto update kubeconfigopensslto generate a random token- ans-x (ansible)
kubectlto talk to the server and install kustomize appshelmto install helm packagedockerto create and run image