KUBECONFIG
To create a kubeconfig file for kubesprayhost
1. Access the Kubernetes cluster using kubectl from kubesprayhost, the KUBECONFIG file is needed. Preferably, it should be using the default file name and location, ${HOME}/.kube/config, on kubesprayhost.
2. Create the ${HOME}/.kube directory on kubesprayhost :
mkdir -p ${HOME}/.kube
3. Copy KUBECONFIG from any cluster node:
sudo scp \
/etc/kubernetes/admin.conf \
iceadmin@kubesprayhost:.kube/config
4. Ensure KUBECONFIG is secure on kubesprayhost:
chown -R iceadmin ${HOME}/.kube
chmod -R go-rwx ${HOME}/.kube
5. Verify Kubernetes cluster version. Use kubectl to verify the Kubernetes version is 1.28.5:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.28.5", .....
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.28.5", .....
6. Verify Kubernetes cluster state. Use kubectl to ensure the Kubernetes cluster state is healthy. Pay particular attention to any pod that shows excessive number of restarts. Such typically indicates there is underlying connectivity and/or networking issue:
kubectl get nodes -o wide
kubectl get pods -o wide -A
7. Install additional tools for ICE Server installation
sudo snap install jq
and
sudo snap install helm --classic
8. Define the local storage class. Install Rancher local path provisioner.
Note: StatefulSets require persistent volumes. Obtain a copy of the local storage class yaml from Rancher:
_TMP_URL=https://raw.githubusercontent.com/rancher/local-path-provisioner
wget ${_TMP_URL}/master/deploy/local-path-storage.yaml
local-path-storage.yaml, by default, uses the /opt/local-path-provisioner directory as the dynamic storage path. You should review the directory setting and change local-path-storage.yaml to match your installation.
If default directory location is acceptable, create a new filesystem or directory /opt/local-path-provisioner on all three cluster nodes.
sudo mkdir -p /opt/local-path-provisioner
Note: Indentation in a yaml file is significant. Do not alter the indentation of the key/values in local-path-storage.yaml
9. After reviewing local-path-storage.yaml, create the storage class. This command is to be executed only once:
kubectl create -f local-path-storage.yaml
10. Scale up local path provisioner. Since the cluster has three nodes, run the following command to scale the provisioner to match number of cluster nodes:
kubectl -n local-path-storage \
patch deployment local-path-provisioner \
-p '{"spec":{"replicas":3}}'
11. Set local path provisioner as default storage class. Typically, the Rancher local storage class should be the default local storage provisioner:
cat > patch_local_path_provisioner.json << EOF
{
"metadata": {
"annotations": {
"storageclass.kubernetes.io/is-default-class": "true"
}
}
}
EOF
kubectl patch storageclass local-path -p "$(cat patch_local_path_provisioner.json)"
12. Verify the local storage class is ready and is the default:
kubectl get storageclass