Skip to main content

Expose a Service

Use a LoadBalancer Service to expose Pods on CKS to the public Internet

One way of exposing Pods on CKS to the public Internet is to use a LoadBalancer Service. These Services expose Pods to the Internet via public IPv4 addresses. Additionally, public DNS names can also optionally be assigned to them.

Create a Load Balancer Service

Create the manifest

A Service of type: LoadBalancer is created by deploying a Service manifest onto CKS. Here is a sample manifest:

loadbalancer-example.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/coreweave-load-balancer-type: public
name: example-sshd
spec:
type: LoadBalancer
externalTrafficPolicy: Local
ports:
- name: sshd
port: 22
protocol: TCP
targetPort: sshd
selector:
app.kubernetes.io/name: sshd

In the example above:

  • The Service (example-sshd) is configured as type: LoadBalancer.
  • The coreweave-load-balancer-type annotation is public.

This creates a publicly-accessible Load Balancer Service.

Info

The address assigned to the Service is the next available address from CoreWeave's default egress IP addresses for each Region.

Deploy the manifest

Apply the manifest using kubectl. For example:

Example
$
kubectl apply -f example-sshd.yaml

Locate the IPv4 address

After the manifest is applied, use describe to see the deployed Service, for example:

Example
$
kubectl describe services example-sshd

The assigned public IPv4 address is found under the LoadBalancer Ingress field.

Learn more

For more information, see the official Kubernetes documentation.