Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Code Block
titlenginx-svc-lb.yaml
linenumberstrue
apiVersion: v1
kind: Service
metadata:
  labels:
    app: myapp-svc
    type: front-end
  name: nginx-svc-lb
spec:
  type: LoadBalancer
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    type: front-end
Code Block
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f nginx-svc-lb.yaml 
service/nginx-svc-lb created

sansae@sansaeAir15m2 k8s-lab-workspace % k get svc
NAME                 TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes           ClusterIP      10.0.0.1       <none>        443/TCP        29h
nginx-svc            ClusterIP      10.0.133.111   <none>        80/TCP         5h50m
nginx-svc-lb         LoadBalancer   10.0.69.70     <pending>     80:32050/TCP   5s
nginx-svc-nodeport   NodePort       10.0.159.138   <none>        80:30008/TCP   11m

sansae@sansaeAir15m2 k8s-lab-workspace % k get svc
NAME                 TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)        AGE
kubernetes           ClusterIP      10.0.0.1       <none>           443/TCP        29h
nginx-svc            ClusterIP      10.0.133.111   <none>           80/TCP         5h50m
nginx-svc-lb         LoadBalancer   10.0.69.70     20.249.176.154   80:32050/TCP   18s
nginx-svc-nodeport   NodePort       10.0.159.138   <none>           80:30008/TCP   11m
sansae@sansaeAir15m2 k8s-lab-workspace %