$ kubectl get pod NAME READY STATUS RESTARTS AGE nginx-deployment-65d79b77dd-brsgf 1/1 Running 0 8m9s nginx-deployment-65d79b77dd-rxqbc 1/1 Running 0 8m14s nginx-deployment-65d79b77dd-vq8gz 1/1 Running 0 8m16s $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 94m nginx-svc LoadBalancer 10.43.45.206 192.168.1.150 80:30080/TCP 14m
测试访问外部ip
curl http://192.168.1.150 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } 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 <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p> </body> </html>