@zhangyy
2020-01-16T13:35:26.000000Z
字数 1381
阅读 115
kubernetes系列
- 一: kubernetes 的命令介绍
- 二: kubernetes 的 生命周期管理
- 三: kubernetes 的远程连接处理
kubectl get all
kubectl get all -o wide
kubectl get all -o wide -n kube-system
kubectl get pods,svc,nodes -o wide -n kube-system --all-namespaces
kubectl 部署一个nginx
1、创建
kubectl run nginx --replicas=3 --image=nginx:1.14 --port=80
kubectl get deploy,pods
2、发布
kubectl expose deployment nginx --port=80 --type=NodePort --target-port=80 --name=nginx-service
kubectl get service
3、更新
kubectl set image deployment/nginx nginx=nginx:1.15
4、回滚
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx
kubectl rollout undo deployment/nginx --to-revision=1
5、删除
kubectl delete deploy/nginx
kubectl delete svc/nginx-service
login:192.168.100.11 master 节点
cd /opt/kubernetes/ssl
vim config.sh
----
kubectl config set-cluster kubernetes \
--certificate-authority=ca.pem \
--embed-certs=true \
--server=https://192.168.100.11:6443 \
--kubeconfig=config
kubectl config set-credentials cluster-admin \
--certificate-authority=ca.pem \
--embed-certs=true \
--client-key=admin-key.pem \
--client-certificate=admin.pem \
--kubeconfig=config
kubectl config set-context default --cluster=kubernetes --user=cluster-admin --kubeconfig=config
kubectl config use-context default --kubeconfig=config
----
./config.sh
生成config 文件
scp config root@192.168.100.13:/root
login : 192.168.100.13 node 节点
kubectl --kubeconfig=./config get pods
mv config /root/.kube/
kubectl get node