How to Enable kubectl on Node Nodes
November 7, 2024Less than 1 minute
How to Enable kubectl on Node Nodes
First, on the node, create the directory:
mkdir -p /etc/kubernetes
Then, open the k3s.yaml file:
cat /etc/rancher/k3s/k3s.yaml vi /etc/rancher/k3s/k3s.yaml
Modify the server address from 127.0.0.1 to the VM's IP address.
Next, transfer the k3s.yaml file to the respective nodes:
scp /etc/rancher/k3s/k3s.yaml [email protected]:/etc/kubernetes/admin.conf scp /etc/rancher/k3s/k3s.yaml [email protected]:/etc/kubernetes/admin.conf
On the node, configure the kubeconfig file by running:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bashrc source ~/.bashrc kubectl get nodes
