linkedsecrets

Linkedsecrets

Requirements

Kubernetes Secrets Support

Linkedsecrets can create Kubernetes secrets types bellow:

Kubernetes Docker Config Secrets

Docker config secrets type is auto-detected by Linkedsecrets based on cloud secrets fields. If your cloud secrets have at least fields “docker-username” and “docker-password”, Linkedsecrets will create a Kubernetes secrets with type “kubernetes.io/dockerconfigjson”.

Follow bellow all supported cloud secrets fields to create Kubernetes Docker config secrets:

If “docker-server” field is ommited, Linkedsecrets will assign default value “https://index.docker.io/v1/”.

Base64 encoded data

To create secrets with base64 encoded data, just encode file content and add to secrets field.

Linkedsecrets will decode data and create Kubernetes secret. If data decoded results in a non UTF8 string, undecoded data will be used to create Kubernetes secret.

Kubeideas Helm repo

Configure kubeideas Helm repository locally:

helm repo add kubeideas https://kubeideas.github.io/linkedsecrets/

Search repository:

helm search repo kubeideas

Install Linkedsecrets Custom Resource Definitions (CRD)

Before install Linkedsecrets Helm chart, install manually Linkedsecrets CRD:

kubectl apply -f https://github.com/kubeideas/linkedsecrets/releases/download/v0.8.4/security.kubeideas.io_linkedsecrets.yaml

Enable GCP Secret Manager Access

[IMPORTANT] Avoid security issues and grant access only to secrets strictly relevant to your Kubernetes cluster.

helm upgrade --install \
linkedsecrets \
--create-namespace=true \
--namespace=<LINKEDSECRETS-NAMESPACE> \
--set gcp.enabled=true \
--set-file gcp.credentialFile="path/<GCP_CREDENTIALS_FILE>.json" \
kubeideas/linkedsecrets

Enable AWS Secrets Manager Access

Create AWS user with permissions to read secrets.

[IMPORTANT] Avoid security issues and grant access only to secrets strictly relevant to your Kubernetes cluster.

helm upgrade --install \
linkedsecrets \
--create-namespace=true \
--namespace=<LINKEDSECRETS-NAMESPACE> \
--set aws.enabled=true \
--set aws.awsAccessKeyId="<AWS_ACCESS_KEY_ID>" \
--set aws.awsSecretAccessKey="<AWS_SECRET_ACCESS_KEY>" \
kubeideas/linkedsecrets

Enable Azure Keyvault Access

Register an App on Azure Active directory with permissions to get and list secrets.

[IMPORTANT] Avoid security issues and grant access only to secrets strictly relevant to your Kubernetes cluster.

helm upgrade --install \
linkedsecrets \
--create-namespace=true \
--namespace=<LINKEDSECRETS-NAMESPACE> \
--set azure.enabled=true \
--set azure.azureTenantId="<AZURE_TENANT_ID>" \
--set azure.azureClientId="<AZURE_CLIENT_ID>" \
--set azure.azureClientSecret="<AZURE_CLIENT_SECRET>" \
kubeideas/linkedsecrets

Enable IBM Secrets Manager Access

Create IBM Service Api Key with permission on role SecretsReader.

helm upgrade --install \
linkedsecrets \
--create-namespace=true \
--namespace=<LINKEDSECRETS-NAMESPACE> \
--set ibm.enabled=true \
--set ibm.ibmServiceApiKey="<IBM_SERVICE_API_KEY>" \
kubeideas/linkedsecrets

Enable Mixed Cloud Secrets Solution Access

This example bellow enables Google Secret Manager and AWS Secrets Manager access, but any combination is allowed.

[IMPORTANT] Avoid security issues and grant access only to secrets strictly relevant to your Kubernetes cluster.

helm upgrade --install \
linkedsecrets \
--create-namespace=true \
--namespace=<LINKEDSECRETS-NAMESPACE> \
--set gcp.enabled=true \
--set-file gcp.credentialFile="path/<GCP_CREDENTIALS_FILE>.json" \
--set aws.enabled=true \
--set aws.awsAccessKeyId="<AWS_ACCESS_KEY_ID>" \
--set aws.awsSecretAccessKey="<AWS_SECRET_ACCESS_KEY>" \
kubeideas/linkedsecrets

Verifying installation

kubectl get pods -n <LINKEDSECRETS-NAMESPACE>

Linkedsecret spec fields details

kubectl explain linkedsecret.spec

Linkedsecret status fields details

kubectl explain linkedsecret.status

Linkedsecrets commom fields

Commom fields are applicable for all supported Cloud providers:

apiVersion: security.kubeideas.io/v1
kind: LinkedSecret
metadata:
  name: <LINKEDSECRET-NAME>
spec:
  rolloutRestartDeploy: <DEPLOYMENT-NAME>
  keepSecretOnDelete: <true | false>
  secretName: <KUBERNETES-SECRET-NAME-CREATED-AND-MAINTAINED-BY-LINKEDSECRETS>
  schedule: <"@every 10m" | ANY-OTHER-SYNCHRONIZATION-INTERVAL>
  suspended: <true | false>

Field rolloutRestartDeploy

Set this field with deployment’s name which secret is maintained by LinkedSecrets. If any change is detected, Linkedsecrets will roll out all deployment’s pods automatically. This field can be omitted if you don’t whant to use this feature.

Field keepSecretOnDelete

Set this field to true if you want to keep secret intact after Linkedsecret object is deleted. This field can be omitted if you don’t whant to use this feature.

This feature is particularly useful in upgrade situations.

Field secretName

It defines the Kubernetes Secret name that will be created and maintained by Linkedsecrets.

Field schedule

Linkedsecrets synchronization is executed based on schedule. Pre-defined cron expressions and Classic cron expressions are accepted.

Pre-defined Cron Expressions examples

Expression Description
“@every 300s” Run every 5 minutes
“@every 10m” Run every 10 minutes
“@every 5m30s” Run every 5 minutes and 30 seconds
“@hourly” Run once an hour, beginning of hour
“@daily” Run once a day, midnight
   

Cron Expressions examples

Expression Description
“*/20 * * * * *” Run every 20 seconds
“0 */5 * * * *” Run every 5 minutes
“0 0 * * * *” Run once an hour, beginning of hour
“0 0 0 * * *” Run once a day, midnight
   

[IMPORTANT] Have in mind that Cloud will charge you on each secret created and access operations. Having said that, tune the schedule accordingly.

suspended

Use this field any time you need to stop data synchronization between Kubernetes Secret and Cloud Secret.

Cloud Provider specific instructions

Click here for GCP details and examples.

Click here for AWS details and examples.

Click here for Azure details and examples.

Click here for IBM details and examples.

Uninstall Linkedsecrets

Remove linkedsecrets objects

If you intend to keep applications secrets intact after remove Linkedsecrets objects, do not forget to enable option "keepSecretOnDelete" on all of them before.

kubectl patch lns <NAME> --type='json' -p='[{"op": "replace", "path": "/spec/keepSecretOnDelete", "value":true}]' -n <NAMESPACE>
kubectl delete lns --all --all-namespaces

Remove helm chart

helm -n <LINKEDSECRETS-NAMESPACE> delete linkedsecrets

Remove Custom Resource Definitions

kubectl delete -f https://github.com/kubeideas/linkedsecrets/releases/download/v0.8.4/security.kubeideas.io_linkedsecrets.yaml

Remove Linkedsecrets namespace

kubectl delete namespace <LINKEDSECRETS-NAMESPACE>