Create a load balancer service

This configuration creates a Kubernetes service of type LoadBalancer to expose your application to external traffic. This makes the application publicly accessible over the internet via an external IP address.

Code sample

YAML

apiVersion: v1
kind: Service
metadata:
  name: <YOUR-SERVICE-NAME>
spec:
  type: LoadBalancer
  selector:
    app: <YOUR-APPLICATION-NAME>
  ports:
  - port: 80
    targetPort: 8080

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.