Skip to main content

How do I restrict who can reach the API server?

Syself support For release

To restrict Kubernetes API server access by IP, use a KubeGate source-CIDR policy. KubeGate runs in front of the API server on every control-plane node and drops client connections from addresses that are not on your list.

You put the allowed IP ranges in a Secret on the management cluster and turn the policy on with the kubeGatePolicySecretRef variable on your Cluster. The Cluster Configurator writes this part of the manifest for you. You apply the Cluster like any Kubernetes resource, with kubectl or a GitOps tool.

Turn the policy on after the cluster is running, not in the manifest that creates it. If the cluster is in the middle of an upgrade to a new Kubernetes version, let the upgrade finish first. Syself Autopilot and the cluster's own nodes keep their access, so the policy only decides which of your clients get through.

Turning the policy on replaces the control-plane nodes one at a time. A later change to the list works the same way: edit the Secret, then roll the control plane. A wrong list blocks your own clients, and you can always correct it, because the policy lives on the management cluster.

With the default endpoint, clients connect over IPv4. If your API endpoint is a DNS name with an IPv6 (AAAA) record, list your clients' IPv6 ranges too. An IPv4 range never matches an IPv6 client.

Follow KubeGate: restrict API server access for the policy format, the rollout and a test that shows a blocked client is dropped. The endpoint keeps its public address. To see why that is safe, read Kubernetes without a private network.

Still stuck?

Prepare your case, then email us.