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:
apiVersion: v1kind: Servicemetadata:annotations:service.beta.kubernetes.io/coreweave-load-balancer-type: publicname: example-sshdspec:type: LoadBalancerexternalTrafficPolicy: Localports:- name: sshdport: 22protocol: TCPtargetPort: sshdselector:app.kubernetes.io/name: sshd
In the example above:
- The Service (
example-sshd
) is configured astype: LoadBalancer
. - The
coreweave-load-balancer-type
annotation ispublic
.
This creates a publicly-accessible Load Balancer Service.
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:
$kubectl apply -f example-sshd.yaml
Locate the IPv4 address
After the manifest is applied, use describe
to see the deployed Service, for example:
$kubectl describe services example-sshd
The assigned public IPv4 address is found under the LoadBalancer Ingress
field.
For more information, see the official Kubernetes documentation.