Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provision to remote k8s clusters #489

Open
mlbiam opened this issue Oct 29, 2020 · 1 comment
Open

Provision to remote k8s clusters #489

mlbiam opened this issue Oct 29, 2020 · 1 comment
Assignees
Milestone

Comments

@mlbiam
Copy link
Contributor

mlbiam commented Oct 29, 2020

Goal is to be able to provision to remote k8s clusters using the same API used to provision to the local cluster. Need to be able to interact with the same APIs, building an additional API is neither desired nor required.

Option 1 - Service Account

A ServiceAccount with cluster-admin privileges is provisioned in the target cluster and stored as a Secret in the control plane cluster's OpenUnison.

ou_multicluster_sa

Pros:

  • Simple
  • Users are familiar with the pattern
  • Works with any cluster

Cons:

  • ServiceAccount tokens not meant to be used outside of the cluster
  • Tokens have no expiration
  • manual rotation required
  • if compromised, no way to know

Option 2 - Certificate Authentication

A key pair and CSR is generated from the control plane OpenUnison, submitted to the target cluster's CertificateSigningRequest API. The approved certificate is imported into OpenUnison and provided cluster-admin rights via RBAC. OpenUnison uses the certificate for interacting with the target cluster.

ou_multicluster_cert

Pros:

  • K8s native process
  • The "secret" (Private Key), never leaves the control plane cluster

Cons:

  • Many "managed" clusters don't support signing arbitrary CSRs via CertificateSigningRequest API.
  • Requires direct connection to the API server
  • Requires multiple steps, kind of kludgy for users that don't have experience with PKI management
  • Manual rotation
  • Api server doesn't recognize CRLs, so certificate can't be revoked

Option 3 - Service Proxy

Deploy an OpenUnison instance to the target cluster who's ServiceAccount has cluster-admin privileges. The OpenUnison is a reverse proxy to the target cluster's API server that expects OpenID Connect id_token in each request issued by the control plane OpenUnison. The target OpenUnison would get the control plane OpenUnison's signature validation public key via the oidc discovery API. The id_token generated by the control plane's OpenUnison would have a one minute time-to-live to limit the impact if it were compromised.

ou_multicluster_proxy

Pros:

  • The "secrets" (target's Secret and control plane's private key for signing id_token) never leaves their respective cluster
  • The target OpenUnison can leverage the TokenRequest api to project rotating tokens for its ServiceAccount to mitigate a compromised token
  • The control plane OpenUnison can generate a new signing keypair at any time, with target cluster's OpenUnison getting that new verification key automatically via the oidc discovery API.
  • Works with Ingress and multiple TLS termination points

Cons:

  • Requires an OpenUnison on every target cluster (though likely will already have one for cluster authentication)
  • OpenUnison on target cluster needs to be privileged - could run separately from authentication cluster to limit potential scope of impact?
  • Target OpenUnison must be able to communicate with control plane OpenUnison to support oidc discovery API

Option 4 - Message bus based communication

Deploy an OpenUnison instance to the target cluster who's ServiceAccount has cluster-admin privileges. The target cluster OpenUnison is not exposed via Ingress. It listens for requests on the same message bus the control plane cluster runs on. When the control plane OpenUnison wants to communicate with a target OpenUnison it does so via message bus. The request is sent via one queue and the response to another.

ou_multicluster_messagebus

Pros:

  • No need to provide an Ingress for the target cluster openunison, potentially exposing a ServiceAccount to an attacker from outside of the cluster
  • Can deploy target openunison independent of the cluster's login portal

Cons:

  • Potentially a complex integration
  • Dependent on user's message bus infrastructure
  • If using integrated ActiveMQ, additional "Credentials" need to be created for each target and ActiveMQ needs to be exposed to outside clusters.
  • Asynchronous communications can be complex
@mlbiam
Copy link
Contributor Author

mlbiam commented Feb 19, 2021

functional, but needs quite a bit of docs. will add in next release

@mlbiam mlbiam modified the milestones: 1.0.21, 1.0.22 Feb 19, 2021
@mlbiam mlbiam modified the milestones: 1.0.22, 1.0.23 Apr 13, 2021
@mlbiam mlbiam modified the milestones: 1.0.23, 1.0.24 May 17, 2021
@mlbiam mlbiam modified the milestones: 1.0.24, 1.0.25 Nov 30, 2021
@mlbiam mlbiam modified the milestones: 1.0.25, 1.0.27 Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant