Review legacy kube-apiserver insecure binding settings

Disable legacy insecure API-server HTTP listeners and migrate to protected administration paths.

Description

On older kube-apiserver versions, --insecure-bind-address selected the address for the insecure HTTP listener. The flag had no effect from Kubernetes 1.20 and was removed in 1.24.

Potential impact

With that port enabled, even a loopback listener lets processes that can reach it use the API without TLS, authentication or authorization.

Remediation

Move clients to an API endpoint protected by TLS, authentication and authorization. On versions that still support the insecure listener, close it with --insecure-port=0. Verify the server no longer listens for insecure HTTP and upgrade to a supported release.

Examples

In Kubernetes 1.6 the first setting selects 127.0.0.1 and the second disables the insecure port. Removing the bind-address setting alone leaves an enabled port open.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: api-server
spec:
  containers:
    - name: kube-apiserver
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command:
        - "kube-apiserver"
        - "--insecure-bind-address=127.0.0.1"

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: api-server
spec:
  containers:
    - name: kube-apiserver
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command:
        - "kube-apiserver"
        - "--insecure-port=0"

References