[k8s] kubectl install, Node2Pod and Pod2Pod

 

[0. kubectl install]

# download 
https://sandbox-expriment-files.obs.cn-north-1.myhuaweicloud.com:443/20221021/kubernetes-client-linux-amd64.tar.gz
or
https://dl.k8s.io/v1.28.8/kubernetes-client-linux-amd64.tar.gz

# unzip

tar -zxvf kubernetes-client-linux-amd64.tar.gz
cp /root/kubernetes/client/bin/kubectl /usr/local/bin/
chmod +x /usr/local/bin/kubectl



# config

scp
cce01-kubeconfig.json root@cce-k8s:/root


mkdir $HOME/.kube
cp cce01-kubeconfig.json $HOME/.kube/config
# switch context
kubectl config use-context internal
kubectl cluster-info

 

 

[1.Node2Pod]
kubectl run nginx --image=nginx --port 80
kubectl get pods -o wide
ssh cce01-node1-IP
curl Pod-IP

[2.Pod2Pod]
kubectl run -it busybox --image=busybox
another terminal: kubectl get pods -o wide
telnet pod-nginx-ip 80
exit
kubectl delete pod busybox nginx

 

posted on 2025-04-12 10:04  天涯人  阅读(4)  评论(1)    收藏  举报

导航