kuberos

by joaquinito2051

Helm chartv0.2.0App 2018-07-03

An OIDC authentication helper for Kubernetes

About this chart

Kuberos OIDC Helper

This is a config snippet generator for a k8s cluster

TL;DR;

Sorry you will need to look at the configuration values below for this one.

$ helm install <helm-repo>/kuberos -f custom-values.yaml

$ helm install incubator/kuberos -f custom-values.yaml

Warning

The config snippets that are generated from this chart include OIDC connection details in clear text. These include content that would normally be in secrets.

Introduction

This chart deploys the kuberos code snippet generator for clusters using both

  • OIDC - OpenID Connect, an authentication layer on top of OAuth 2.0
  • RBAC - Role Based Access Controls (in your k8s cluster)

It provides a quick and easy way for an authenticated user to generate and download config for kubectl.

This work is inspired from step 7 of the work @noqcks did using other tooling.

Prerequisites

  • Kubernetes 1.8+ with RBAC enabled
  • An OIDC provider eg G Suite
  • RBAC on your cluster configured to use OIDC

Configuration

The following table lists the configurable parameters of the kuberos chart

Config params which probably need changing

These ones will be site specific and may contain sensitive information

ParameterDescriptionDefault
kuberosApp Specific config optionsSee below
oidcClientURLURL of OIDC provider endpointhttps://accounts.google.com
oidcClientIDYour unique client IDREDACTED.apps.googleusercontent.com
oidcSecretThe password for the Client ID above.Junk See Provider below
clustersList of clusters to generate config forSee below
nameThe friendly name of the clusterdev-cluster
apiServerThe endpoint for kubectl to use'https://api.dev-cluster.example.com
caCrtThe Public CA cert for the clusterSee values.yaml
ingressA standard ingress blockSee below
enabledEnables or Disables the ingress blockfalse
annotationsIngress annotations{}
hostsList of FQDN's the be browsed toNot Set
tlsList of SSL certs to useEmpty list
secretNameName of the secret to useNot Set
hostsList of FQDN's the above secret is associated withNot Set
serviceA standard service blockSee below
typeService typeClusterIP
portService port80
annotationsService annotations{}

Other Config params can be left alone

In some conditions you might want to set image.tag to latest and then image.pullPolicy to Always this is generally advised against for stability reasons.

In general config params not listed above can be ignored / left alone. The rest of the params are standard enough the google and other charts will be better at explaining them than me

OIDC (Provider) Setup

You will need to obtain the OIDC details of the provider you need to use. This will contain the Issuer URL, Client ID and the Client Secret. In the case of Google (The provider which was used when initially creating this) go to the Developer / Credentials console. You will need to add the ingress url to both

  • Authorised JavaScript origins - https://kuberos.example.com
  • Authorised redirect URIs - https://kuberos.example.com/ui

If you used kops the credentials you're after are

apiVersion: kops/v1alpha2
kind: Cluster
  authorization:
    rbac: {}
  kubeAPIServer:
    authorizationRbacSuperUser: admin
    oidcClientID: UNIQUE_ID_REDACTED.apps.googleusercontent.com
    oidcIssuerURL: https://accounts.google.com
    oidcUsernameClaim: email

For G Suite : The redacted part of a ClientID is about 45 alphanumeric characters long (may also contain a hyphen or two) The client secret will be about 25 alphanumeric chacters (may also contain a hyphen or two)

Deploy kuberos with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kuberos on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkuberos is pinned at v0.2.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply