How to publish K8S service svc, through a simple example to understand what
Simulation environment is as follows:
The MASTER-K8S: 192.168.250.100
K8S-NODE01: 192.168.250.101
K8S-NODE02: 192.168.250.102
above assumptions have been installed environment
aims
192.168.250.200 achieved through service access to our real K8s of svc, thus achieving our visit Pod
Specific operation
Enter the Master node, start the deployment with the following command, and add a realization we needed svc
docker pull nginx
kubectl run http --image=nginx --port=80 --replicas=3
kubectl expose deployment http --type=NodePort \
--external-ip=192.168.250.200 --name=http-svc --port=80 --target-port=80
#到这里应该是完成了,我们查看一下
kubectl get svc
kubectl get deployment
kubectl get pods -o wide
test
curl 192.168.250.200
#成功