重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
kubectl create ns nginx-test
kubectl delete ns nginx-test
创建Deployment并暴露为Servicekubectl create deployment deployment-nginx --image=nginx -n nginx-test # 创建deployment,会自动创建一个相应的Pod
kubectl scale deployment deployment-nginx --replicas=2 -n nginx-test # 将deployment下的pod扩容到2个
kubectl expose deployment deployment-nginx --name=service-nginx --type=NodePort --port=80 --target-port=80 -n nginx-test # 暴露为Servie
kubectl get deployment,pod,service -n nginx-test -o wide
宿主机通过master1节点访问Nginx:http://192.168.111.30:32163
宿主机通过node1节点访问Nginx:http://192.168.111.33:32163
宿主机通过node2节点访问Nginx:http://192.168.111.34:32163
kubectl delete deployment deployment-nginx -n nginx-test # 删除deployment,级联删除其下的所有pod
删除服务kubectl delete service service-nginx -n nginx-test
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧