Deploy NGINX on Kubernetes Metallb
Step 1: Deploying an NGINX deployment
Command:
kubectl create deployment nginx --image=quay.io/redhattraining/nginx:1.21 --port=80
NAME READY UP-TO-DATE AVAILABLE AGE nginx 1/1 1 1 10s
Step 2:
Check status of existing services
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 12m
Step 3:
Expose the existing deployment on a service
kubectl expose deployment nginx --type LoadBalancer --port 80 --target-port 80
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13m nginx LoadBalancer 10.100.31.4 192.168.49.50 80:30839/TCP 4s
Step 4:
Try a curl and see the results
curl http://192.168.49.50
<!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>