https://ke.qq.com/course/366778?taid=2773354872674490
1、minukub (https://kubernetes.io/docs/tutorials/hello-minikube/)
使用minikube把东西发布出去
minikube service hello-node
mini配置
minikube addons list
minikube addons enable heapster
2、kubectl:
pod:
就是一堆container
deployment:
用来检查pod的健康性
kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node
expose:
把k8s里面的deployment发布出去, 这个是minikube的内网
kubectl expose deployment hello-node --type=LoadBalancer --port=8080
config:
kubectl config view
get:
kubectl get deployments
kubectl get pods detail: kubectl get pods -o wide
kubectl get services
kubectl get events
k8s get pods --show-labels
k8s get pods -l app=nginx
查看一个services是负载均衡哪一个pod的,可以直接知道docker容器地址
k8s get endpoints
看所有pod和service
kubectl get pod,svc -n kube-system
delete
kubectl delete service hello-node
kubectl delete deployment hello-node
查看deployment运行状态,可能在拉镜像那些
kubectl rollout status deployment nginx-deployment
查看deployment详细信息
kubectl describe deployment nginx-deployment
查看k8s状态
kubectl get cs componentstatus
查看节点
kubectl get node
执行命令的时候,加上--record
k8s edit deployment nginx-deployment --record 注意这个时候,如果你的操作和以往的版本是一样的,他就会相当于你undo了的。
使用这个可以改名:kubectl annotate deployment
然后可以 k8s rollout undo deployment nginx-deployment
k8s rollout history deployment nginx-deployment 是查看历史日志的
k8s rollout undo deployment nginx-deployment
k8s rollout undo deployment nginx-deployment --to-revision=3
k8s scale 可以改变副本数量