Docker & Kubernetes for Developers · Aula

Gerenciando Secrets com segurança usando armazenamentos externos

Pare de versionar Secrets em texto simples e integre o Kubernetes a cofres externos, como o HashiCorp Vault, usando o External Secrets Operator.

Aula 4 de 413 etapas

Gerenciando Secrets com segurança usando armazenamentos externos é uma aula grátis de Docker & Kubernetes for Developers no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Docker & Kubernetes for Developers, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Docker & Kubernetes for Developers inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Kubernetes Secrets Are Only Encoded

By default a Kubernetes Secret is just base64-encoded, not encrypted. Anyone with API access or etcd access can read it unless extra protection is added.

Encryption at Rest

A first step is enabling encryption at rest in the API server so Secret data is encrypted before being written to etcd.

apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
  - resources: ["secrets"]
    providers:
      - aescbc:
          keys:
            - name: key1
              secret: <base64-key>

The Git Problem

In GitOps, committing Secret YAML to a repo leaks credentials. We need secrets that live outside git but still flow into the cluster.

External Secret Stores

Tools like HashiCorp Vault, AWS Secrets Manager, and GCP Secret Manager store secrets centrally with auditing, rotation, and fine-grained access.

The External Secrets Operator

The External Secrets Operator (ESO) syncs values from an external store into native Kubernetes Secrets, so workloads consume them normally.

Defining a SecretStore

A SecretStore tells ESO how to authenticate to the backend.

apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: vault-backend
spec:
  provider:
    vault:
      server: https://vault.example.com
      path: secret
      auth:
        kubernetes:
          role: my-app

Defining an ExternalSecret

An ExternalSecret maps a key in the store to a generated Kubernetes Secret.

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: db-creds
spec:
  secretStoreRef:
    name: vault-backend
    kind: SecretStore
  target:
    name: db-creds
  data:
    - secretKey: password
      remoteRef:
        key: database/prod
        property: password

Automatic Rotation

ESO refreshes synced secrets on an interval, so rotating a value in Vault propagates into the cluster without redeploys.

spec:
  refreshInterval: 1h

Sealed Secrets Alternative

If you must keep secrets in git, Sealed Secrets encrypts them with a cluster-only key, producing a safe-to-commit SealedSecret that only the controller can decrypt.

Limiting Access With RBAC

Restrict who can read Secrets using RBAC, and prefer mounting secrets as files over environment variables to reduce accidental logging.

Avoiding Leaks

Never echo secrets in logs or CI output, and add secret-scanning to your pipeline to catch accidental commits.

Quick Check

Test what you have learned.

Recap

You learned that Secrets are only base64-encoded, how encryption at rest helps, and how the External Secrets Operator syncs from Vault and similar stores, plus Sealed Secrets, rotation, and RBAC to keep credentials safe.

Grátis para começar

Aprenda Docker & Kubernetes for Developers com um tutor de IA — grátis

Escreva e execute código real no seu navegador, obtenha ajuda instantânea de um tutor de IA 24/7 e continue de onde parou na web ou no app.

Cursos
12
Aulas
48

Perguntas Frequentes

A aula “Gerenciando Secrets com segurança usando armazenamentos externos” é grátis?

Sim — o texto completo de “Gerenciando Secrets com segurança usando armazenamentos externos” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Docker & Kubernetes for Developers, atualize para CoddyKit PRO. O curso de Docker & Kubernetes for Developers inclui 4 aulas no total.

O que vou aprender em “Gerenciando Secrets com segurança usando armazenamentos externos”?

Pare de versionar Secrets em texto simples e integre o Kubernetes a cofres externos, como o HashiCorp Vault, usando o External Secrets Operator. Você pratica Docker & Kubernetes for Developers com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Docker & Kubernetes for Developers?

Nenhuma experiência prévia é necessária. Docker & Kubernetes for Developers no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Gerenciando Secrets com segurança usando armazenamentos externos”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Docker & Kubernetes for Developers?

Sim. Cada aula de Docker & Kubernetes for Developers inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Controle de acesso baseado em funções (RBAC)
  2. Segurança de pods e verificação de imagens
  3. Protegendo o tráfego de rede do Kubernetes
  4. Gerenciando Secrets com segurança usando armazenamentos externos
← Voltar para Docker & Kubernetes for Developers