Skip to content

KCSA · Domain 3: Kubernetes Security Fundamentals · 22% of the exam

Task 3.3: Authentication

Users and service accounts, X.509 client certificates, bearer and bound service account tokens, OIDC and webhook authentication.

Study it

  • Authentication and authorization with RBAC

    Lesson coming

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

A company puts an authenticating reverse proxy in front of kube-apiserver. The proxy authenticates users with single sign-on and passes their identity in X-Remote-User and X-Remote-Group headers. To save work, the API server's --requestheader-client-ca-file points at the cluster's general client CA, which also issues the client certificates of administrators, nodes and several automation tools. Why is this a problem, and what should change?

  1. AAny holder of a cert from that CA can assert identities; use a proxy-only CA and allowed names
  2. BIdentities taken from headers skip authorization, so the proxy must enforce RBAC itself
  3. CThe headers are ignored unless X-Remote-Group is also listed in --requestheader-username-headers
  4. DThe API server ignores the headers from a cert of that CA; give the proxy its own CA so they count
Show the answer and why
  • AAny holder of a cert from that CA can assert identities; use a proxy-only CA and allowed names

    Correct

    The API server trusts the headers from any client whose certificate validates against that CA (and, if set, has a CN in --requestheader-allowed-names); the documentation warns not to reuse a CA that is used in a different context.

  • BIdentities taken from headers skip authorization, so the proxy must enforce RBAC itself

    Incorrect

    Header authentication only establishes who the user is; every request is still authorized by the API server's configured authorizers.

  • CThe headers are ignored unless X-Remote-Group is also listed in --requestheader-username-headers

    Incorrect

    Group headers are configured with --requestheader-group-headers; the username flag lists only the headers that carry the user name.

  • DThe API server ignores the headers from a cert of that CA; give the proxy its own CA so they count

    Incorrect

    The headers are accepted from any client certificate that validates against the configured CA; the risk is that too many clients can send them, not that the proxy's are ignored.

With an authenticating proxy, the API server trusts its direct client to state who the user is, after that client presents a certificate valid for --requestheader-client-ca-file. If that CA also signs other client certificates, any of those holders can claim any identity, so the proxy needs its own CA and, ideally, --requestheader-allowed-names.

Question 2 · choose 1

A team joins new nodes with bootstrap tokens. It wants each token to stop working automatically shortly after its join window and the token objects to disappear from the cluster afterwards. What should it rely on?

  1. ADeleting the system:bootstrappers group, which revokes every outstanding token at once
  2. BAn expiration on each token Secret, with the token cleaner removing expired tokens
  3. CSetting usage-bootstrap-signing to false in the token Secret once the join is done
  4. DDeleting the cluster-info ConfigMap in kube-public after each join
Show the answer and why
  • ADeleting the system:bootstrappers group, which revokes every outstanding token at once

    Incorrect

    system:bootstrappers is a group name that authenticated tokens receive, not an object that can be deleted to revoke them.

  • BAn expiration on each token Secret, with the token cleaner removing expired tokens

    Correct

    Bootstrap tokens are Secrets in kube-system that can carry an expiration; expired tokens are deleted by the TokenCleaner controller in the controller manager.

  • CSetting usage-bootstrap-signing to false in the token Secret once the join is done

    Incorrect

    That field controls whether the token may be used to sign the cluster-info ConfigMap; it does not stop the token from authenticating.

  • DDeleting the cluster-info ConfigMap in kube-public after each join

    Incorrect

    cluster-info helps joining nodes trust the API server; removing it does not stop a bootstrap token from authenticating.

Each bootstrap token is backed by a Secret of type bootstrap.kubernetes.io/token in kube-system, which can include an expiration. Expired tokens stop authenticating and can be deleted automatically by enabling the tokencleaner controller, in line with the advice to rotate bootstrap credentials once bootstrapping is done.

Question 3 · choose 1

How does kube-apiserver check a bearer token when webhook token authentication is configured?

  1. AIt looks the token up in a Secret in the kube-system namespace and compares it
  2. BIt decodes the token's base64 and trusts the username inside
  3. CIt sends the token in a TokenReview to a remote service and uses the reply
  4. DIt forwards the request to the kubelet to authenticate
Show the answer and why
  • AIt looks the token up in a Secret in the kube-system namespace and compares it

    Incorrect

    That describes bootstrap token Secrets, not webhook authentication.

  • BIt decodes the token's base64 and trusts the username inside

    Incorrect

    A decoded value proves nothing; the remote service validates the token.

  • CIt sends the token in a TokenReview to a remote service and uses the reply

    Correct

    Webhook token authentication is a hook for verifying bearer tokens: the API server posts a TokenReview to the remote service, which says who the user is or that authentication failed.

  • DIt forwards the request to the kubelet to authenticate

    Incorrect

    Authentication of API requests happens at the API server, here through the remote webhook.

With webhook token authentication, the API server delegates token checks: it sends a TokenReview to a configured service, which returns the user's name and groups or a failure. Results can be cached for a configurable time.

Question 4 · choose 1

Which group does the API server add to the group list of every authenticated user?

  1. Asystem:bootstrappers
  2. Bsystem:unauthenticated
  3. Csystem:authenticated
  4. Dsystem:nodes
Show the answer and why
  • Asystem:bootstrappers

    Incorrect

    That group is given to bootstrap tokens used to join nodes, not to every authenticated user.

  • Bsystem:unauthenticated

    Incorrect

    That group is given to anonymous requests, not to authenticated users.

  • Csystem:authenticated

    Correct

    The authentication documentation says that when authentication succeeds, the API server automatically marks the user as a member of the special group system:authenticated.

  • Dsystem:nodes

    Incorrect

    system:nodes is the group of kubelet credentials.

After authentication, every user carries the system:authenticated group, while anonymous requests carry system:unauthenticated. Bindings to system:authenticated therefore apply to anyone who can authenticate at all.

Practice domain 3 →Practice all domains →