学习 Kubernetes(三):kubectl

配置

TODO

常用命令

根据 YAML/JSON 配置文件创建资源:

kubectl create -f <YAML/JSON File>  

删除 Deployment:

kubectl delete deployment <Deployment Name>  

由 Deployment 创建 Service:

kubectl expose deployment <Deployment Name> --port 80 --target-port 80  

建立本地到 Service 端口转发:

kubectl port-forward service/<Service Name> 8080:80  

扩容 Deployment:

kubectl scale --replicas=3 deployment/<Deployment Name>  

升级 Deployment:

kubectl set image deployment/<Deployment Name> <Container Name>=<Image>