-
Cluster version
- kubectl version
Cluster details
- kubectl cluster-info
- kubectl get nodes
- kubectl get deployments
- kubectl proxy
- kubectl get pods
- kubectl describe pods
- kubectl logs $POD_NAME
配置文件
- ~/.kube/config
查看配置
- kubectl config view
查看集群列表
- kubectl config get-clusters
查看 Context 列表
- kubectl config get-contexts
设置当前 Context
- kubectl config use-context dev
Dashboard
部署
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
访问
部署应用
build image
- docker build -t dalufanjiadan/springcloud-payment8002 .
- docker push dalufanjiadan/springcloud-payment8002
创建 deployment
使用本地镜像
- kubectl create deployment springcloud-eureka –image=dalufanjiadan/springcloud-eureka –port=7001
使用 docker hub 镜像
- kubectl create deployment springcloud-eureka –image=docker.io/dalufanjiadan/springcloud-eureka
创建 service
- kubectl expose deployment/springcloud-eureka –type=LoadBalancer –name=springcloud-eureka –port=7001
缩扩容
手动
- kubectl scale deployments/springcloud-eureka –replicas=4