kubectl expose deployment
Jump to navigation
Jump to search
kubectl expose deployment kubectl expose deployment nginxapp --name=nginxclusterip --port=80 --target-port=8080
kubectl expose deployment kubernetes-dashboard -n kube-system --type=NodePort
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service [1]
Verify:
kubectl get services my-service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE my-service ClusterIP 172.20.251.125 <none> 80/TCP 3d5h
if EXTERNAL-IP address is not assigned verify that aws-load-balancer-controller is installed.
Activities
- Understand the differences between:
kubectl create service loadbalancer
andkubectl expose deployment</code
See also
kubectl expose [ deployment | pod ]
↑ https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/
Advertising: