Kubernetes : Kubeadm : Deploy Pods2019/08/26 |
This example is based on the environment like follows.
-----------+---------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.51 eth0|10.0.0.52 +----------+-----------+ +-----------+----------+ +-----------+----------+ | [ dlp.srv.world ] | | [ node01.srv.world ] | | [ node02.srv.world ] | | Master Node | | Worker Node | | Worker Node | +----------------------+ +----------------------+ +----------------------+ |
[1] | Create or Delete Pods. |
# run [test-nginx] pods root@dlp:~# kubectl create deployment test-nginx --image=nginx deployment.apps "test-nginx" created kubectl get pods NAME READY STATUS RESTARTS AGE test-nginx-76b4548894-qpq2j 1/1 Running 0 13s # scale out pods root@dlp:~# kubectl scale deployment test-nginx --replicas=3 deployment.extensions/test-nginx scaled kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES test-nginx-76b4548894-2f269 1/1 Running 0 29s 10.244.1.2 node01.srv.world <none> <none> test-nginx-76b4548894-qpq2j 1/1 Running 0 8m49s 10.244.2.2 node02.srv.world <none> <none> test-nginx-76b4548894-v2rfh 1/1 Running 0 29s 10.244.1.3 node01.srv.world <none> <none> # set service root@dlp:~# kubectl expose deployment test-nginx --port 80 service "test-nginx" exposed kubectl describe service test-nginx Name: test-nginx Namespace: default Labels: app=test-nginx Annotations: <none> Selector: app=test-nginx Type: ClusterIP IP: 10.106.0.134 Port: <unset> 80/TCP TargetPort: 80/TCP Endpoints: 10.244.1.2:80,10.244.1.3:80,10.244.2.2:80 Session Affinity: None Events: <none> # verify accesses root@dlp:~# curl 10.106.0.134 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> ..... ..... <p><em>Thank you for using nginx.</em></p> </body> </html> |
Sponsored Link |
|