2021-03-16 17:24:01 +00:00
2020-11-12 02:40:49 +00:00
---
2021-02-22 23:52:23 +00:00
title: Architecture
description: Dive into the overall design and implementation details of Pinniped.
2020-11-12 02:40:49 +00:00
cascade:
layout: docs
2021-02-17 23:02:57 +00:00
menu:
docs:
name: Architecture
weight: 100
2021-02-22 23:52:23 +00:00
parent: background
2020-11-12 02:40:49 +00:00
---
2020-11-06 22:42:57 +00:00
The principal purpose of Pinniped is to allow users to access Kubernetes
clusters. Pinniped hopes to enable this access across a wide range of Kubernetes
environments with zero configuration.
2020-12-18 14:39:36 +00:00
Pinniped is composed of two parts.
2021-02-22 23:52:23 +00:00
2020-12-18 14:39:36 +00:00
1. The Pinniped Supervisor is an OIDC server which allows users to authenticate
with an external identity provider (IDP), and then issues its own federation ID tokens
to be passed on to clusters based on the user information from the IDP.
1. The Pinniped Concierge is a credential exchange API which takes as input a
credential from an identity source (e.g., Pinniped Supervisor, proprietary IDP),
authenticates the user via that credential, and returns another credential which is
2021-03-16 21:09:53 +00:00
understood by the host Kubernetes cluster or by an impersonation proxy which acts
on behalf of the user.
2020-11-06 22:42:57 +00:00
2020-12-18 22:13:29 +00:00
![Pinniped Architecture Sketch ](/docs/img/pinniped_architecture_concierge_supervisor.svg )
2020-11-06 22:42:57 +00:00
2020-12-18 23:09:50 +00:00
Pinniped supports various authenticator types and OIDC identity providers and implements different integration strategies
2020-11-06 22:42:57 +00:00
for various Kubernetes distributions to make authentication possible.
## External Identity Provider Integrations
2020-12-18 14:39:36 +00:00
The Pinniped Supervisor will federate identity from one or more IDPs.
Administrators will configure the Pinniped Supervisor to use IDPs via Kubernetes
custom resources allowing Pinniped to be managed using GitOps and standard
Kubernetes tools.
Pinniped supports the following IDPs.
1. Any [OIDC-compliant ](https://openid.net/specs/openid-connect-core-1_0.html )
identity provider (e.g., [Dex ](https://github.com/dexidp/dex ),
[Okta ](https://www.okta.com/ )).
The
2021-01-08 23:21:23 +00:00
[`idp.supervisor.pinniped.dev` ](https://github.com/vmware-tanzu/pinniped/blob/main/generated/1.20/README.adoc#k8s-api-idp-supervisor-pinniped-dev-v1alpha1 )
2020-12-18 14:39:36 +00:00
API group contains the Kubernetes custom resources that configure the Pinniped
Supervisor's upstream IDPs.
More IDP integrations are coming soon.
2020-11-06 22:42:57 +00:00
2020-12-17 23:55:05 +00:00
## Authenticators
2020-12-18 14:39:36 +00:00
The Pinniped Concierge requires one or more **authenticators** to validate external credentials in order to
issue cluster specific credentials.
Administrators will configure authenticators via Kubernetes custom
2020-12-17 23:55:05 +00:00
resources allowing Pinniped to be managed using GitOps and standard Kubernetes tools.
Pinniped supports the following authenticator types.
2020-11-06 22:42:57 +00:00
1. Any webhook which implements the
[Kubernetes TokenReview API ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#webhook-token-authentication ).
In addition to allowing the integration of any existing IDP which implements this API, webhooks also
serve as an extension point for Pinniped by allowing for integration of arbitrary custom authenticators.
While a custom implementation may be in any language or framework, this project provides a
sample implementation in Golang. See the `ServeHTTP` method of
2020-11-13 14:15:46 +00:00
[cmd/local-user-authenticator/main.go ](https://github.com/vmware-tanzu/pinniped/blob/main/cmd/local-user-authenticator/main.go ).
2020-11-06 22:42:57 +00:00
2020-12-18 14:39:36 +00:00
1. A JSON Web Token (JWT) authenticator, which will validate and parse claims
from JWTs. This can be used to validate tokens that are issued by the
Pinniped Supervisor, any
[OIDC-compliant ](https://openid.net/specs/openid-connect-core-1_0.html )
identity provider, or various other identity sources. The JWT authenticator
provides the same functionality as the [Kubernetes OIDC authentication
mechanism](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens),
but it is configurable at cluster runtime instead of requiring flags to be
set on the `kube-apiserver` process.
The
2021-01-08 23:21:23 +00:00
[`authentication.concierge.pinniped.dev` ](https://github.com/vmware-tanzu/pinniped/blob/main/generated/1.20/README.adoc#k8s-api-authentication-concierge-pinniped-dev-v1alpha1 )
2020-12-18 14:39:36 +00:00
API group contains the Kubernetes custom resources that configure the Pinniped
Concierge's authenticators.
2020-11-06 22:42:57 +00:00
## Cluster Integration Strategies
Pinniped will issue a cluster credential by leveraging cluster-specific
2020-12-17 23:55:05 +00:00
functionality. In the longer term,
2020-11-06 22:42:57 +00:00
Pinniped hopes to contribute and leverage upstream Kubernetes extension points that
cleanly enable this integration.
Pinniped supports the following cluster integration strategies.
2021-03-16 17:46:06 +00:00
* Token Credential Request API: Pinniped hosts a credential exchange API endpoint via a Kubernetes aggregated API server.
2020-11-06 22:42:57 +00:00
This API returns a new cluster-specific credential using the cluster's signing keypair to
issue short-lived cluster certificates. (In the future, when the Kubernetes CSR API
provides a way to issue short-lived certificates, then the Pinniped credential exchange API
will use that instead of using the cluster's signing keypair.)
2021-03-16 17:24:01 +00:00
* Impersonation Proxy: Pinniped hosts an [impersonation ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation )
2021-03-16 21:09:53 +00:00
proxy that sends requests to the Kubernetes API server with user information and permissions based on a token.
2020-11-06 22:42:57 +00:00
## kubectl Integration
2020-12-18 14:39:36 +00:00
With any of the above IDPs, authentication methods, and cluster integration strategies, `kubectl` commands receive the
2020-11-06 22:42:57 +00:00
cluster-specific credential via a
[Kubernetes client-go credential plugin ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins ).
Users may use the Pinniped CLI as the credential plugin, or they may use any proprietary CLI
2020-11-13 14:17:47 +00:00
built with the [Pinniped Go client library ](https://github.com/vmware-tanzu/pinniped/tree/main/generated ).
2020-11-06 22:42:57 +00:00
2020-12-18 14:39:36 +00:00
2021-01-08 23:21:23 +00:00
## Pinniped Deployment Strategies
2020-12-18 22:13:29 +00:00
Pinniped can be configured to authenticate users in a variety of scenarios.
Depending on the use case, administrators can deploy the Supervisor, the Concierge,
both, or neither.
2020-12-18 14:39:36 +00:00
2020-12-18 22:13:29 +00:00
### Full Integration-- Concierge, Supervisor, and CLI
2020-12-18 14:39:36 +00:00
2020-12-18 22:13:29 +00:00
Users can authenticate with the help of the Supervisor, which will issue tokens that
2021-03-19 20:57:08 +00:00
can be exchanged at the Concierge for a credential that can be used to authenticate to
the host Kubernetes cluster.
2020-12-18 22:13:29 +00:00
The Supervisor enables users to log in to their external identity provider
once per day and access each cluster in a domain with a distinct scoped-down token.
2020-12-18 14:39:36 +00:00
2020-12-18 22:54:30 +00:00
The diagram below shows the components involved in the login flow when both the Concierge
and Supervisor are configured.
2020-12-18 22:13:29 +00:00
![concierge-with-supervisor-architecture-diagram ](/docs/img/pinniped_architecture_concierge_supervisor.svg )
2020-11-06 22:42:57 +00:00
2020-12-18 22:54:30 +00:00
The diagram below demonstrates using `kubectl get pods` with the Pinniped CLI
2020-12-18 14:39:36 +00:00
functioning as a [Kubernetes client-go credential plugin ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins )
that obtains a federation ID token from the Pinniped Supervisor to be sent to a
JWT authenticator via the Pinniped Concierge.
2020-11-06 22:42:57 +00:00
2020-12-18 14:39:36 +00:00
![concierge-with-supervisor-sequence-diagram ](/docs/img/pinniped-concierge-supervisor-sequence.svg )
2020-12-18 22:13:29 +00:00
### Dynamic Cluster Authentication-- Concierge and CLI
Users can authenticate directly with their OIDC compliant external identity provider to get credentials which
2021-03-19 20:57:08 +00:00
can be exchanged at the Concierge for a credential that can be used to authenticate to
the host Kubernetes cluster.
2020-12-18 22:13:29 +00:00
2021-01-08 23:21:23 +00:00
The diagram below shows the components involved in the login flow when the Concierge is
2020-12-18 22:54:30 +00:00
configured.
2020-12-18 22:13:29 +00:00
![concierge-with-webhook-architecture-diagram ](/docs/img/pinniped_architecture_concierge_webhook.svg )
2020-12-18 22:54:30 +00:00
The diagram below demonstrates using `kubectl get pods` with a [Kubernetes client-go credential plugin ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins )
2020-12-18 22:13:29 +00:00
that obtains an external credential to be sent to a webhook authenticator via the Pinniped Concierge.
![concierge-with-webhook-sequence-diagram ](/docs/img/pinniped-concierge-sequence.svg )
### Static Cluster Integration-- Supervisor and CLI
Users can authenticate with the help of the Supervisor, which will issue tokens that
2021-01-08 23:21:23 +00:00
can be given directly to a Kubernetes API Server that has been configured with
2020-12-18 22:13:29 +00:00
[OIDC Authentication. ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens )
The Supervisor enables users to log in to their external identity provider
once per day and access each cluster in a domain with a distinct scoped-down token.
### Minimal-- CLI only
Users can authenticate directly with their OIDC compliant external identity provider to get credentials
that can be given directly to a Kubernetes API Server that has been configured with
[OIDC Authentication. ](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens )