Exposing Openshift API server with F5 CIS

When integrating F5 CIS with OpenShift, a common requirement is exposing internal ClusterIP services externally through BIG-IP virtual servers. For most services, CIS works exactly as expected, however, the Kubernetes API server is special.

Problem Statement

I want cluster operators to be able to access the Kubernetes API server from outside of the cluster, so I want to load balance TCP/6443 traffic to the management plane servers. However, when I use CIS to expose the service “kubernetes” in the “default” namespace, the pool members are empty on the BIG-IP. Why?

I could manually set up a VIP on tcp/6443, where each of my master nodes are pool members. But, I want this VIP to be created and updated by CIS, because I want to auto-scale my management plane servers.

Background

If you’re a user of F5 Container Ingress Services (CIS), you know that you can use CIS to configure F5 BIG-IP, creating a VIP with pool members that are pods within the Kubernetes or OpenShift cluster.

Typically this is an application, like a web app where you expose HTTP or HTTPS, or other traffic, like a database connection where you’re exposing, for example, TCP/5432. With OpenShift clusters, these pods will typically run on the worker nodes, and the pods will get IP addresses from the Pod CIDR block.

However, the service “kubernetes” in the namespace “default” is special - it’s pods are on the host network (not the pod network), and it’s endpoints are manually updated - it doesn’t use labels and selectors like a typical K8s service.

This article focuses on OpenShift, not a generic K8s cluster, but we’ll discuss other distributions at the end.

The Two API Services in OpenShift

OpenShift exposes the Kubernetes API server through two Services:

Service Namespace Purpose
kubernetes default Standard upstream Kubernetes API access
apiserver openshift-kube-apiserver OpenShift infrastructure/operator access

Both ultimately reach the same kube-apiserver instances running on control plane nodes.

The implementation details, however, are very different.

The default/kubernetes Service Is Special

The upstream “kubernetes.default.svc” does not use selectors.

You can verify this:

oc get svc kubernetes -n default -o yaml

Notice there is no selector:

spec:
  clusterIP: 172.30.0.1
  ports:
  - port: 443
    targetPort: 6443

This Service exists to solve a bootstrap problem:

How can workloads reliably discover the API server before normal Kubernetes controllers are fully operational?

As explained in this excellent article from NetworkOP:

“…the endpoints for default/kubernetes are populated through special internal reconciliation logic rather than standard selector-based endpoint management.”

Why This Matters for F5 CIS

F5 CIS expects Kubernetes Services to behave conventionally:

Service
  -> Selector
     -> Pods
        -> EndpointSlices
           -> BIG-IP Pool Members

This works perfectly for most application workloads. However, default/kubernetes breaks several assumptions:

  • no selector
  • manually managed endpoints
  • special reconciliation behavior
  • not intended for generic ingress exposure

The issue is not that the Service lacks endpoints. The issue is that the Service was never designed to function as a standard externally exposed Service. CIS does not support services where Endpoints are manually updated. It only supports services that use labels and selectors to update endpoints.

OpenShift Provides a Better Alternative

OpenShift introduces: openshift-kube-apiserver/apiserver.

Unlike default/kubernetes, this Service behaves much more like a standard Kubernetes Service. Inspect it:

oc get svc apiserver -n openshift-kube-apiserver -o yaml

You will typically observe:

  • selector-backed behavior
  • standard EndpointSlice reconciliation
  • integration with OpenShift service CA management

This makes it far more compatible with CIS.

Important Clarification

The kube-apiserver instances are still static control-plane pods managed by the cluster-kube-apiserver-operator.

This is not a normal Deployment. The distinction is not about the backend pods themselves. The distinction is about:

  • how the Services are reconciled
  • how endpoints are managed
  • which consumers are expected to use them

We Do Not Want Internal API Traffic Through BIG-IP

BIG-IP should not sit in the middle of Kubernetes east-west control-plane traffic. The goal is only to expose the API externally.

Recommended model:

Traffic Type Path
Internal cluster traffic Native cluster networking
kubelet → apiserver Native networking
operator → apiserver Native networking
External admin/API access BIG-IP
External console access BIG-IP

BIG-IP is excellent for:

  • external HA
  • TLS termination
  • WAF
  • external load balancing

…but internal control-plane communication should remain native.

What if I don’t use OpenShift? What if I have a generic K8s cluster?

Great question! This aritcle is specifically about OpenShift, which conveniently provides the openshift-kube-apiserver/apiserver service as a selector-backed alternative. In vanilla Kubernetes, you don’t have that luxury — you’re stuck with default/kubernetes, which has the exact problem described: no selector, manually managed endpoints, and special reconciliation behavior that CIS doesn’t play well with.

One option: Create a wrapper Service with a selector. Rather than pointing CIS at default/kubernetes, create your own ClusterIP service in a namespace you control that uses a label selector targeting the kube-apiserver pods directly. On most kubeadm clusters, the static pods on control plane nodes have labels like ‘component: kube-apiserver’ and 'tier: control-plane’. You’d create a Service like:

apiVersion: v1
kind: Service
metadata:
  name: kube-api-expose
  namespace: kube-system
spec:
  selector:
    component: kube-apiserver
  ports:
    - port: 443
      targetPort: 6443

This gives CIS a standard, selector-backed Service it can work with properly.

One caveat: verify the labels on your kube-apiserver static pods with kubectl get pods -n kube-system --show-labels since they can vary slightly between distributions (kubeadm, Rancher, Talos, etc.).

Can I also load balance the OpenShift Web Console?

Yes! The OpenShift admin UI is a separate service from the API server. It runs as its own deployment in the openshift-console namespace, exposed via a Service called console.

Unlike default/kubernetes, the console service is a normal selector-backed service, so CIS will work with it just like any other service. The pods have IP addresses within the pod CIDR block and labels that match the service selector. The nodes are typically worker nodes. Inspect it:

oc get svc console -n openshift-console -o yaml

Summary

The default/kubernetes Service is one of Kubernetes’ oldest and most specialized abstractions. It exists primarily for bootstrap reliability and universal API discovery. It was not designed as a generic ingress target.

When exposing the Kubernetes API externally through F5 CIS, the better option in OpenShift is usually this service: openshift-kube-apiserver/apiserver

This allows BIG-IP and CIS to interact with a more conventional Service abstraction while keeping internal control-plane communication native to the cluster network.

2 Likes