k8s-secrets

by YOTRON

Helm chartv2.0.0MIT

This is a HELM chart to deploy certificates. passwords or Java Truststores as Kubernetes secrets. It is very safe. No applications are deployed.

About this chart

YOTRON is a consultancy company which is focused on DevOps, Cloudmanagement and Data Management with NOSQL and SQL-Databases. Visit us on www.yotron.de ement with NOSQL and SQL-Databases. Visit us on www.yotron.de

k8s-secrets

This HELM project organizes the provisioning of secrets in Kubernetes with K8S secrets. The project is safe to use. No applications are deployed, based purely on HELM functionality.

You can deploy:

  • TLS-Keys/Certs files,
  • basic username/passwords for databases or others,
  • files like Java-TrustStores/KeyStores,
  • docker registries (to authenticate against your own DockerReg) simply with you url, name, password

We recommend using this Repo together with helm-secrets to deploy secrets from your Vault

The secrets are available only for the K8S-namespace the HELM project was deployed to. If you need the secrets for different namespaces, please deploy the project for every namespace.

prerequisites

  • HELM 3

Binary files (e.g., Java KeyStores ) must be provided in their base64 encoded expression. To create a base64 encoded string of a file:

cat <your file> | base64

integration

To integrate the Chart please add the HELM package to your dependencies:

dependencies:
  - name: k8s-secrets
    version: 2.0.0
    repository: http://helm.yotron.de/

configuration

As a basic your values.yaml needs

k8s-secrets:
  ...

for the mapping of the secrets to the HELM Chart.

setup dockerregistries

To add a docker registries you must define the repo and username/password for the docker registry. No need to upload your complete json-syntax!:

k8s-secrets:
  dockerregistries: # a fixed name for this group
    myfirstdockerregistry: # free name of the dockerregistry config, this name can be referenced by the Kubernetes manifest
    - url: https://docker.artifactory.com/dockerhub # URL of you Docker registries
      name: <name for the authentication of your registry>
      password: <password for your registry> 
    - url: https://docker.artifactory.com/dockerhub # URL of you Docker registries
      name: <name for the authentication of your registry>
      password: <password for your registry>   
    myseconddockerregistry:
    ...      

To pull a Docker with the credentials you must add the name of docker registry to your K8S manifest for the deployment, SFS, ... . Here is a snipped for an example to deploy a K8S-Pod with a container from a docker repo:

spec:
  imagePullSecrets:
    - name: myfirstdockerregistry
  containers:
    - name: grafana
      image: https://docker.artifactory.com/dockerhub/grafana/grafana:latest

setup secretplain

Setup default secrets which are provided as plaintext.

k8s-secrets:
  secretplain: # fixed name for this group
    ppadmin: # free name of the secret in K8S
      name: admin
      password: mypasswordinplaintext

setup secretbase64

Setup default secrets which are provided in their base63 encoded expression. This is suitable for binaries.

k8s-secrets:
  secretbase64: # fixed name for this group
    myjavakeystruststore: # free name of the secret in K8S
      keystore.jks: YXNjYWNhc2N.....hc2Nhc2Nhc2Nhc2Nhc2M=
      truststore.jks: YXNjYXNjYXNj....YXNjYXNjYXNjYXNjYXNjYXNj

setup basic with username and password

The group basic contains basic-authentication secrets with username and password.

k8s-secrets:
  basic: # fixed name for this group
    cloudpgdb: # free name of the secret in K8S
      username: db1
      userpassword: mypasswordinplaintext

How to add secrets to your deployment of K8S Link

setup tls

The group tls contains tls secrets of K8S with key and cert.

k8s-secrets:
  tls: # fixed name for this group
    mytls: # free name of the tls secret in K8S. 
      crt: |
        -----END CERTIFICATE-----
        ...
        -----BEGIN CERTIFICATE-----
      key: |
        -----BEGIN PRIVATE KEY-----
        ...
        -----END PRIVATE KEY-----

How to add secrets to your deployment of K8S Link

Deploy k8s-secrets with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has k8s-secrets 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-secrets is pinned at v2.0.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