Skip to content

KCSA · Domain 2: Kubernetes Cluster Component Security · 22% of the exam

Task 2.1: API Server

Securing kube-apiserver: TLS, authentication and authorization modes, anonymous requests, admission, audit and limiting network exposure.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

An external load balancer checks /livez and /readyz on kube-apiserver without credentials. The security team wants the API server itself to refuse anonymous access to every other path, even if someone later adds an RBAC binding for system:unauthenticated by mistake. What should the cluster use?

  1. AA ClusterRole that grants only the two health paths, bound to the system:unauthenticated group
  2. BAn authorization-always-allow-paths list that names only /livez and /readyz
  3. CAn AuthenticationConfiguration whose anonymous section allows only /livez and /readyz
  4. DA NetworkPolicy that allows only the load balancer to reach the API server
Show the answer and why
  • AA ClusterRole that grants only the two health paths, bound to the system:unauthenticated group

    Incorrect

    This works at the authorization layer. A later binding for system:unauthenticated would open more paths, which is exactly what the team wants to rule out.

  • BAn authorization-always-allow-paths list that names only /livez and /readyz

    Incorrect

    That setting belongs to components that delegate authorization, such as kube-scheduler: it lets the listed paths skip authorization and refuses nothing else, and kube-apiserver has no such flag.

  • CAn AuthenticationConfiguration whose anonymous section allows only /livez and /readyz

    Correct

    The anonymous authenticator can be configured with conditions; then only the listed endpoints are reachable anonymously, even if the authorization configuration would allow more.

  • DA NetworkPolicy that allows only the load balancer to reach the API server

    Incorrect

    NetworkPolicy filters Pod traffic by source. It does not change how the API server authenticates, and the load balancer's address could still reach every path anonymously.

Configuring the anonymous authenticator in the AuthenticationConfiguration file lets the API server accept anonymous requests only on listed endpoints such as /livez and /readyz. Any other endpoint is unreachable anonymously regardless of what RBAC grants to system:anonymous or system:unauthenticated. An always-allow list of paths only skips authorization for those paths in components that delegate it; it refuses nothing.

Question 2 · choose 1

The team that runs a self-managed control plane must replace the key pair that signs service account tokens. Tokens signed with the old key are held by running workloads and must keep working until they expire, while every new token must be signed with the new key. How should kube-apiserver be configured during the changeover?

  1. APoint --service-account-signing-key-file at both private keys so that either can sign
  2. BReplace the key in --service-account-key-file with the new public key and restart every API server
  3. CChange --service-account-issuer to a new URL so that existing tokens are re-signed automatically
  4. DSign with the new private key and list the old and new public keys in --service-account-key-file
Show the answer and why
  • APoint --service-account-signing-key-file at both private keys so that either can sign

    Incorrect

    The signing key flag takes a single file with the key that signs new tokens. Verification of older tokens is configured separately, through --service-account-key-file.

  • BReplace the key in --service-account-key-file with the new public key and restart every API server

    Incorrect

    Tokens are verified only against the keys in that flag. Without the old public key, tokens signed before the change would be rejected.

  • CChange --service-account-issuer to a new URL so that existing tokens are re-signed automatically

    Incorrect

    The issuer is a claim placed in tokens; changing it does not re-sign tokens that workloads already hold.

  • DSign with the new private key and list the old and new public keys in --service-account-key-file

    Correct

    --service-account-key-file holds the keys used to verify tokens; it may contain several keys and be given several times, so old tokens still verify while the signing key file names only the new key.

kube-apiserver separates signing from verification. --service-account-signing-key-file names the private key that signs new tokens, while --service-account-key-file lists every key used to verify them and can hold several. Keeping the old public key there during rotation lets existing tokens work until they expire.

Question 3 · choose 1

By default, on which port does kube-apiserver listen, and how is that port protected?

  1. APort 8080, over plain HTTP
  2. BPort 10250, protected by TLS
  3. CPort 2379, with mutual TLS
  4. DPort 6443, protected by TLS
Show the answer and why
  • APort 8080, over plain HTTP

    Incorrect

    The API server's default secure port is 6443 with TLS, not a plain HTTP port.

  • BPort 10250, protected by TLS

    Incorrect

    10250 is the kubelet's HTTPS port.

  • CPort 2379, with mutual TLS

    Incorrect

    2379 is the usual etcd client port.

  • DPort 6443, protected by TLS

    Correct

    The documentation says the API server listens on port 6443 by default, protected by TLS; production clusters often serve on 443.

The API server serves on --secure-port, 6443 by default, with TLS using the certificate from --tls-cert-file and --tls-private-key-file. Many production clusters serve on 443.

Question 4 · choose 1

A cluster administrator turns on the audit log backend of kube-apiserver but sets no --audit-policy-file. What does the API server log?

  1. AEvery request at the RequestResponse level
  2. BNo audit events at all, because no policy file was given
  3. COnly failed requests, at a default level
  4. DOnly write requests, at the Request level
Show the answer and why
  • AEvery request at the RequestResponse level

    Incorrect

    Without a policy there are no rules to assign any level, so nothing is logged.

  • BNo audit events at all, because no policy file was given

    Correct

    The auditing documentation says the policy is passed with --audit-policy-file and that if the flag is omitted, no events are logged.

  • COnly failed requests, at a default level

    Incorrect

    There is no default policy; the flag must name a policy for events to be generated.

  • DOnly write requests, at the Request level

    Incorrect

    Without a policy file the API server generates no audit events at all.

Audit policy rules decide which events are recorded and at what level. kube-apiserver reads them from the file given in --audit-policy-file; without that flag no audit events are logged, whatever backend is configured.

Practice domain 2 →Practice all domains →