Use your cluster with kubectl
Download your cluster's kubeconfig once. It keeps working across upgrades and control plane restarts.
Connect with kubectl
- Go to Kubernetes and open your cluster.
- Click Download kubeconfig.
- Save the file as
~/.kube/my-cluster.yaml, with your cluster's name in place ofmy-cluster. - Point
kubectlat it:
Your worker nodes are listed with status Ready.
Secure the Kubernetes API
The kubeconfig holds a cluster-admin token, so anyone with the file has full access to your cluster. Treat it like a private key.
The API endpoint on port 6443 is open to any address by default. Limit it to your office or VPN ranges:
- On the cluster page, click Configure.
- Under API access, replace
0.0.0.0/0with a range you connect from, for example203.0.113.0/24. - Remove the
::/0row. - Click Add CIDR for each other range you need.
- Click Save changes.
Workers reach the control plane over an internal network, so no value here can break your cluster.
Rotate a leaked kubeconfig
Click Rotate kubeconfig on the cluster page and confirm with Rotate kubeconfig. Every previously downloaded kubeconfig stops working within about 10 seconds. Download the new one to keep using kubectl.
Expose a service with a load balancer
A Service of type: LoadBalancer creates a Better Stack load balancer and publishes its public IP addresses in the Service. Deleting the Service removes the load balancer.
EXTERNAL-IP shows <pending> for about 2 minutes while the load balancer boots.
- Its type follows your node count. Set the type or the algorithm when you create the Service, with the
load-balancer.betterstack.com/typeandload-balancer.betterstack.com/algorithmannotations, for exampleLB2andleast_connections. - It's managed by the Service. It's listed in Load balancers and billed as an ordinary load balancer, but you change it through the Service manifest, not the dashboard.
- Node changes don't drop traffic. On a scale-down, recycle or upgrade, a node is taken out of its load balancers before it's drained.
- UDP ports work, but the client's IP address never reaches your pods over UDP.
- NodePorts aren't reachable from the internet. Public traffic always arrives through a load balancer.
No ingress controller is included. Install your own, such as Traefik, behind a LoadBalancer Service.
Get the client's IP address
By default your pods see the load balancer's address, not the caller's. externalTrafficPolicy: Local doesn't change that. To receive the client's IP address, turn on PROXY protocol in your backend and annotate the Service with load-balancer.betterstack.com/proxy-protocol: "v2":
Trust both ranges. 100.89.94.0/24 carries the connection under externalTrafficPolicy: Local, and your pod CIDR, 10.42.0.0/16 by default, under Cluster.
Every pod behind the Service must accept PROXY protocol
A backend that doesn't expect the header reads it as a malformed request, while the load balancer's health checks keep passing. Turn PROXY protocol on in the backend first, then add the annotation.
Store data on persistent volumes
PersistentVolumeClaims get Better Stack volumes from the default StorageClass, betterstack-volume. Leave out storageClassName and claims land there.
- ReadWriteOnce only. A volume is attached to one node at a time.
- Created where the pod runs. A volume is created on first use, on the node its pod lands on. If the pod moves, the volume follows it.
- Grow-only. Raise the claim's request and the filesystem grows online. Up to 10 volumes per node.
- Snapshots work out of the box. A
VolumeSnapshotuses the default classbetterstack-volume-snapshots. Restore one by creating a claim withdataSourcepointing at it. - Volumes outlive the cluster. They're listed in Volumes and billed as ordinary volumes. With the default reclaim policy
Delete, removing the claim removes the volume.
A claim that stays Pending always says why in its events.
For scratch data, the local-path StorageClass keeps data on the node itself. That data is lost when the node is replaced, recycled or reclaimed.
Schedule pods on the right nodes
Every worker carries these labels for node selectors and topology spread constraints:
All nodes of a cluster share one data center.
What else works in the cluster
- Network policies are enforced. A default-deny policy also blocks DNS, so allow egress to CoreDNS in
kube-systemon UDP and TCP port 53 next to it. - Pod autoscaling. metrics-server is installed, so
kubectl topand the HorizontalPodAutoscaler work out of the box. - Admission webhooks and aggregated APIs such as cert-manager, Istio, Kyverno and KEDA work with their charts' defaults.
- Pod hardening.
RuntimeDefaultAppArmor and seccomp profiles load on every worker, so the Pod Security restricted profile needs no node setup. CustomLocalhostAppArmor profiles aren't supported.
Let external services verify pod tokens
The cluster publishes its service-account token issuer through standard OIDC discovery, for verifiers such as HashiCorp Vault:
The verifier needs the cluster's CA certificate. It's the base64-decoded certificate-authority-data in your kubeconfig. The verifier's address must also be allowed under API access, since discovery runs on the same port as kubectl.
Need help?
Please let us know at hello@betterstack.com.
We're happy to help! 🙏