Question Format
Please join node01 worker node to the cluster, and you have to deploy a pod in the node01,
pod name should be web and image should be nginx
Prerequisites
Before proceeding, ensure you have:
A running Kubernetes cluster with a control plane node.
kubeadm, kubelet, and kubectl installed on all nodes.
Administrative access to node01.
Step 1: Retrieve the Join Command
SSH into the master node:
- ssh user@master-node
Generate a join command with a token:
- kubeadm token create --print-join-command
Example output:
- kubeadm join <master-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>
Copy this command for later use on node01.
Step 2: Join node01 to the Cluster
SSH into node01:
- ssh user@node01
Run the copied kubeadm join command:
- sudo kubeadm join <master-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>
Verify the node has joined successfully:
- kubectl get nodes
You should see node01 in the list with a Ready status.
Step 3: Deploy a Pod on node01
Create an nginx pod and schedule it on node01:
- kubectl run web --image=nginx --restart=Never --overrides='{"spec": {"nodeName": "node01"}}'
Verify the pod is running:
- kubectl get pods -o wide
Ensure the NODE column shows node01.