外部Secretストアによる安全なSecret管理
平文のSecretをコミットするのをやめ、External Secrets Operatorを使ってKubernetesをHashiCorp Vaultなどの外部Vaultと連携します。
「外部Secretストアによる安全なSecret管理」はCoddyKit上の無料Docker & Kubernetes for Developersレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDocker & Kubernetes for Developers学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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-appDefining 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: passwordAutomatic Rotation
ESO refreshes synced secrets on an interval, so rotating a value in Vault propagates into the cluster without redeploys.
spec:
refreshInterval: 1hSealed 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.
よくある質問
「外部Secretストアによる安全なSecret管理」レッスンは無料ですか?
はい。「外部Secretストアによる安全なSecret管理」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Docker & Kubernetes for Developersコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。
「外部Secretストアによる安全なSecret管理」で何を学びますか?
平文のSecretをコミットするのをやめ、External Secrets Operatorを使ってKubernetesをHashiCorp Vaultなどの外部Vaultと連携します。 ブラウザで直接実行するハンズオンコードでDocker & Kubernetes for Developersを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Docker & Kubernetes for Developersを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDocker & Kubernetes for Developersは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「外部Secretストアによる安全なSecret管理」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDocker & Kubernetes for Developersレッスンでコードを書いて実行できますか?
はい。すべてのDocker & Kubernetes for Developersレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ロールベースアクセス制御(RBAC)
- Podセキュリティとイメージスキャン
- Kubernetesネットワークトラフィックの保護
- 外部Secretストアによる安全なSecret管理