k8s-ldap-auth

by vbouchaud

Helm chartv0.2.0App v4.0.0Verified publisher

Kubernetes webhook token authentication plugin implementation using ldap.

About this chart

K8s-ldap-auth Helm Chart

k8s-ldap-auth is a kubernetes webhook token authentication plugin implementation using ldap.

NOTICE: This chart uses api version 2 which is only supported by helm v3+. This chart only install k8s-ldap-auth. You need to have access to an already configured LDAP server.

TL;DR;

$ helm repo add vbouchaud https://vbouchaud.github.io/chartrepo/

# generating private and public key for JWT signing
$ openssl genrsa -out key.pem 4096
$ openssl rsa -in key.pem -outform PEM -pubout -out public.pem

# fetching the default values.yml for further editions
$ helm show values vbouchaud/k8s-ldap-auth > values.yml
ingress:
  enabled: true
  className: traefik
  hosts:
    - host: app.valhall.local
      paths:
        - path: /cluster/ldap

config:
  ldap:
    address: ldaps://ldap.valhall.local
    bindDn: uid=k8s-ldap-auth,ou=services,ou=valhall,o=local
    bindPassword: P@ssw0rd
    user:
      searchBase: ou=people,ou=valhall,o=local
      searchFilter: (uid=%s)
  keys:
    # insert here the private key you generated previously
    privateKeyData: |-
      -----BEGIN PRIVATE KEY-----
      MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQDU4WQez1ww4llv
      # ...
      9QJeAv5SSy/Tuj9vkaI+1cdrnNagkJLKY1BFOYi0WXuq1rsUvxQvIStxtcewYF2a
      hfnkt+Md2qZtLxjOFYN51Y3lVk3e
      -----END PRIVATE KEY-----
      
    # insert here the public key you generated previously
    publicKeyData: |-
      -----BEGIN PUBLIC KEY-----
      MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1OFkHs9cMOJZb/p9VgoZ
      # ...
      neybKNLe7Ftz6ZMC1aFRjROgDD8wbfDoz9KpYHwT4HqgmMFLqUKx1BCEFKls1hT5
      UKJaCLzmZMb3pMl63/8WfoUCAwEAAQ==
      -----END PUBLIC KEY-----
$ helm install k8s-ldap-auth vbouchaud/k8s-ldap-auth --values values.yml 

Getting Started

  1. Add the chart repository with helm repo add vbouchaud https://vbouchaud.github.io/chartrepo/
  2. Configure the chart by setting the various parameters, either in a locally downloaded values.yaml or in the next step.
  3. Install the chart with helm install k8s-ldap-auth vbouchaud/k8s-ldap-auth and optionally set your values with --values values.yaml or via --set [parameter]=[value].

Parameters

ParameterDescriptionDefault
replicaCountNumber of instances running.1
image.repositoryThe container registry to use when pulling the image.quay.io/vbouchaud/k8s-ldap-auth
image.pullPolicyThe policy to ue when pulling the image.IfNotPresent
image.tagOverrides the image tag whose default is the chart appVersion.nil
imagePullSecretsThe k8s secret names to use for the pullSecrets.[]
nameOverrideProvide a name in place of kube-prometheus-stack for app: labels.nil
fullnameOverrideProvide a name to substitute for the full names of resources.nil
serviceAccount.createSpecifies whether a service account should be created.true
serviceAccount.annotationsAnnotations to add to the service account.{}
serviceAccount.nameThe name of the service account to use.nil
podAnnotationsAnnotations to add to the pod template.{}
podSecutiryContextSecurity context to add to the pod.{}
securityContextSecurity context to add to the container.{}
service.typeService type.ClusterIp
service.portService port.80
ingress.enabledWhether to create an ingress.false
ingress.classNameIngress classname to use.nil
ingress.annotationsIngress specific annotations.{}
ingress.hosts[0].hostThe domain to use for the ingress.chart-example.local
ingress.hosts[0].paths[0].pathThe path to use for the ingress./
ingress.hosts[0].paths[0].pathTypeThe path type to use for the ingress.ImplementationSpecific
ingress.tlsThe tls secrets to use for the domain.[]
resourcesResources object for the container.{}
config.ldap.addressThe ldap host (and scheme) the server will authenticate against.nil
config.ldap.bindDnThe service account dn to do the ldap search.nil
config.ldap.bindPasswordThe service account password to do the ldap search.nil
config.ldap.user.searchBaseThe dn where the ldap search will take place.nil
config.ldap.user.searchFilterThe filter to select users.nil
config.ldap.user.searchScopeThe scope of the search. Can take to values base object: 'base', single level: 'single' or whole subtree: 'sub'.nil
config.ldap.user.memberofPropertyThe property that will be used to fetch groups. Usually memberof or ismemberof.nil
config.ldap.user.usernamePropertyThe property that will be used as username in the TokenReview.uid
config.ldap.user.extraPropertiesExtra user properties to fetch. Those will be stored in extra values in the UserInfo object.nil
config.keys.privateKeyDataThe key used to sign the token.nil
config.keys.publicKeyDataThe key to verify the token.nil
config.token.ttlThe TTL for newly generated tokens, in seconds.nil
autoscaling.enabledWhether to enable autoscaling.false
autoscaling.minReplicasMinimum number of replicas.1
autoscaling.maxReplicasMaximum number of replicas.10
autoscaling.targetCPUUtilizationPercentageCPU level configuration for autoscaling.80
autoscaling.targetMemoryutilizationpercentageMemory level configuration for autoscaling.nil
nodeSelectorNode selector.{}
tolerationsTolerations.[]
affinityAffinity.{}

Deploy k8s-ldap-auth with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has k8s-ldap-auth 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 chartk8s-ldap-auth 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