Loadbalancer service
Course: Kubernetes Part 1 - chapter 19
In Kubernetes, a LoadBalancer service type is a way to expose a service to external clients. When you create a Service of type LoadBalancer, Kubernetes will automatically provision an external load balancer from your cloud provider (e.g., AWS, Google Cloud, Azure) to route traffic to your Kubernetes service
Creating a kubernetes cluster in vultr
Section titled “Creating a kubernetes cluster in vultr”
- Create deployment.yml
apiVersion: apps/v1kind: Deploymentmetadata: name: nginx-deploymentspec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80- Apply deployment
kubectl apply -f deployment.yml- Create
service-lb.yml
apiVersion: v1kind: Servicemetadata: name: nginx-servicespec: selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80 type: LoadBalancer- Apply the service
kubectl apply -f service-lb.yml