Zero Trust Kubectl Access - Rafay Product Documentation

Architecture

The Kube API server is at the center of all operations within Kubernetes. Admins interact with it through the CLI or by accessing the API directly. Almost any operation on the cluster can be performed using these access patterns. As a result, securing the Kube API server SHOULD be the first line of defense for any organization.

KubeCTL is the preferred CLI for running commands against Kubernetes clusters. Cluster administrators use this CLI to manage their Kubernetes clusters. KubeCTL operations are sensitive to network latency. As a result, organizations follow the deployment patterns described below to enable remote operations on Kubernetes clusters.

Common Access Patterns

Publicly Accessible API Server

Often administrators publicly expose the API Server to enable remote management of the cluster using KubeCTL. There are several issues with this approach:

Important

Deploying k8s clusters with publicly accessible API servers is an extremely POOR security practice and is NOT recommended at all.

VPN or Bastion Hosts

An administrator may deploy a bastion host to secure access to the k8s API Server. The KubeCTL commands are performed from the bastion host. There are several issues with this approach:

Kube API Access Proxy

Goals

The goals of the Kube API Access Proxy are

Great User Experience

Great Admin Experience

Centralized Security Enforcement

Centralized Auditing

Great Performance

Access Patterns

With the "Kube API Access Proxy", organizations can enable their users and CI/CD systems to securely interact with remote clusters without taking on unnecessary security risks. The image above describes some of the common access patterns possible

Workflow (Access through console)

kube-API server (Cluster) Relay agent (Cluster) Controller User kube-API server (Cluster) Relay agent (Cluster) Controller User Login request through browser Determines Type of user (Local or IDP) Local or IDP user authentication Performs user authentication and authorization Assigns role(s) to the user for the session Initiates kubectl access through console Service account creation with configured inactive/idle period Service account created with appropriate role/role binding User executes kubectl commands Relay agent forwards user requests to kube-api server Check if service account needs to be removed based on configured idle period Initiation of service account, role, role binding removal Service account, role, role binding get removed

Workflow (Access through CLI)

kube-API server (Cluster) Relay agent (Cluster) Controller User kube-API server (Cluster) Relay agent (Cluster) Controller User Downloads kubeconfig from the controller Initiates a kubectl command (TLS connection, client authentication) Validates CN from the client certificate in kubectl request to identify user Performs user authentication and authorization Service account creation with configured inactive/idle period Service account created with appropriate role/role binding Relay agent forwards user requests to kube-api server Check if service account needs to be removed based on configured idle period Initiation of service account, role, role binding removal Service account, role, role binding get removed