# kubectl create -f dp.yaml deployment "ngnix-deployment-15" created # kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE ngnix-deployment-152222101s # kubectl get pods NAME READY STATUS RESTARTS AGE ngnix-deployment-15-55bd7c9fd-bm5vg 1/1 Running 0101s ngnix-deployment-15-55bd7c9fd-lz75v 1/1 Running 0101s
# kubectl create -f svc.yaml service "nginx-service" created # kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 192.168.0.1 <none> 443/TCP 3d4h nginx-service ClusterIP 192.168.212.156 <none> 80/TCP 11s
# kubectl get pods NAME READY STATUS RESTARTS AGE nginx 1/1 Running 0 4s # kubectl exec -it nginx bash root@nginx:/# cat /etc/resolv.conf nameserver 192.168.0.2 search default.svc.cluster.local svc.cluster.local cluster.local options ndots:5
oot@nginx:/# curl http://nginx-service:80 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>
<p>For online documentation and support please refer to <ahref="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <ahref="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p> </body> </html>