kube-apiserver uses a basic authentication file

Replace legacy password-file authentication with a supported authentication method.

Description

--basic-auth-file authenticated API users with names and passwords stored in a local file. Kubernetes removed it in 1.19.

Potential impact

An exposed file or client password can grant API access with that user’s permissions.

Remediation

On a legacy cluster, configure a supported replacement such as OIDC, assign the required permissions and test sign-in. Migrate existing clients before removing the flag and retiring the passwords and file. When upgrading to a supported release, verify TLS, least-privilege authorization and auditing.

Examples

The Kubernetes 1.6 excerpts show the password-file option being removed. Configure replacement authentication and certificates separately.

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"
        - "--basic-auth-file=/path/to/auth.csv"

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"

References