Setting Up a Kubernetes Cluster: Post-Installation Steps
Congratulations! Your Kubernetes cluster is ready, and we’re setting up the user environment.
We are only a few steps away from the finish line. Soon, you will be able to create pods, deployments, and more in your cluster.
1. Configure kubectl for Regular Users
kubectl for Regular UsersTo use kubectl (the Kubernetes command-line tool), follow these steps:
Create the
.kubedirectory in your home folder:
(Note: Execute the below command from the user where you want to manage your Kubernetes cluster.)
mkdir -p $HOME/.kubeCopy the Kubernetes configuration file to your user's home directory:
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configChange ownership of the configuration file to your user:
sudo chown $(id -u):$(id -g) $HOME/.kube/config2. Verify Node Status
Your node status is not ready yet! Don't worry, it will be ready soon.
kubectl get nodes3. Set Up Autocomplete for kubectl
kubectlTo enable autocomplete for kubectl in your current shell session, run:
To make this change permanent, add the following line to your ~/.bashrc file:
4. Install WeaveNet CNI
WeaveNet is a popular Container Network Interface (CNI) plugin for Kubernetes. It provides networking between pods across different nodes in the cluster.
Execute the following command to apply the WeaveNet CNI configuration:
5. Verify Node Status
After applying WeaveNet, check the status of your nodes:
Your nodes should now show the status as "Ready."
2. Join Additional Nodes to the Cluster ,
This need to be execute from the worker nodes.
To add more nodes to your cluster, run the following command on each node as the root user:
Replace <control-plane-host>, <control-plane-port>, <token>, and <hash> with the appropriate values.
Alternatively, you can get the same join command by executing the following on the master node:
Now you're all set! Your Kubernetes cluster is ready.
Feel free to make any necessary modifications to this document. If you have any questions or additional requests, please let me know. 😊
References
Last updated