🖊️
Notes
  • Notes
  • aws
    • CloudWatch
    • EKS
    • IAM
    • Key Management Service (KMS)
    • security
      • Attacks against AWS infrastructure
    • vpc
      • AWS Transit Gateway
  • azure
    • Azure AD
    • Azure CDN
    • DNS in Azure
    • Hub-spoke network topology
    • Identity and access management
    • Azure Landing zones
    • Storage
  • certifications
    • aws-sa-pro
    • Certified Kubernetes Administrator
  • containers
    • Examples
    • Linux Container Primitives
  • databases
    • Relational databases
  • gcp
    • IAM
  • git
    • Git
  • golang
    • Building Go projects
    • Concurrency
    • Project structure
  • infosec
    • SSH
    • SSL
  • Kubernetes
    • Admission Controllers
    • Autoscaling
    • Debugging
    • Multi-tenancy
    • Network Policies
    • Pod Priority
    • Pod Security Policies
    • Secrets
    • StatefulSet
    • additional-services
      • Debugging ArgoCD RBAC
      • open-policy-agent
  • misc
    • FFmpeg
    • PDFs
  • programming
    • Learning resources
    • concepts
      • Serialization
  • rabbitmq
    • Clustering and HA
    • Shovel plugin
  • shells
    • Bash
  • terraform
    • Moving resources between remote states
  • vim
    • Fzf (plugin)
    • Registers
    • Spell Check
  • linux
    • arch
      • Arch Linux installation
Powered by GitBook
On this page
  • Decode secrets
  • Resources
  1. Kubernetes

Secrets

  • Secret API object

    • stores secrets as base64 encoded in etcd

    • encryption comes with extra-configuration or integration

    • plain-text values can be used with "stringData" attribute

  • Encryption at rest (with EncryptionConfiguration API object)

    • Defines a key which encrypts and decrypts Secrets in etcd

    • however, the encryption key is in plain-text in apiserver

      • this is a concern if apiserver and etcd are co-hosted on a same node

    • keys must rotated

  • KMS (Envelope encryption)

    • Data is encrypted with Data encyption key (DEK)

    • DEK is encrypted with Key Encryption Key (KEK)

    • Data and and enrypted DEK are stored side-by-side

    • When data is decrypted, a call to KMS provider is done to decrypt the DEK

      • so the secret is never transmitted to KMS provider

    • Most usable with cloud providers with KMS service

  • External provider

    • Hashicorp Vault

    • Integration on

      • platform level

        • Vault Injection

          • creates init container for fetching secrets from Vault

            • uses mutating webhook to inject Vault init container

          • or run as sidecar, and fetch if secrets secrets are modified

      • application level

  • Sealed secrets

    • mostly solves the problem of keeping secrets safe outside of Kubernetes

    • plain-text copies of sealed secret controller secrets and secrets itself are stored to etcd. So encrypting etcd need to be solved somehow

  • csi-secret-driver

    • mount secrets/keys/certs to pod using a CSI volume

    • still in experimental state

Decode secrets

Decodes all values of certain secret.

kubectl get secret <secret_name> -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'

Resources

PreviousPod Security PoliciesNextStatefulSet

Last updated 4 years ago

TGI Kubernetes 113: Kubernetes Secrets Take 3 -

How To Decode / Decrypt Kubernetes Secret -

https://www.youtube.com/watch?v=an9D2FyFwR0
https://github.com/bitnami-labs/sealed-secrets
https://github.com/kubernetes-sigs/secrets-store-csi-driver
https://www.hashicorp.com/blog/injecting-vault-secrets-into-kubernetes-pods-via-a-sidecar/
https://computingforgeeks.com/how-to-decrypt-kubernetes-secret/