Password Depot
External Secrets Operator가 Password Depot API와 통합해서 Password Depot의 시크릿을 Kubernetes 클러스터에 동기화하는 방법을 다루는 페이지예요.
출처: External Secrets
본문
External Secrets Operator는 Password Depot API와 통합해 Password Depot를 Kubernetes 클러스터에 있는 시크릿으로 동기화해요.
인증 (Authentication)
API는 사용자 이름과 비밀번호가 필요해요.
apiVersion: v1
kind: Secret
metadata:
name: password-depot-secret
labels:
type: password-depot
type: Opaque
stringData:
username: the-username-for-password-depot
password: the secret password
시크릿 스토어 업데이트 (Update secret store)
Kind=SecretStore에 passworddepot 프로바이더가 나열되어 있고 host와 database가 설정되어 있는지 확인하세요.
apiVersion: external-secrets.io/v1alpha1
kind: ClusterSecretStore
metadata:
name: external-secrets-store
spec:
# provider field contains the configuration to access the provider
# which contains the secret exactly one provider must be configured.
provider:
passworddepot:
host: host-of-password-depot # port is 8714 by default
database: "password depot database name"
auth:
SecretRef:
credentials:
name: password-depot-secret
namespace: external-secrets
외부 시크릿 만들기 (Creating external secret)
Password Depot 변수를 Kubernetes 클러스터의 시크릿으로 동기화하려면 Kind=ExternalSecret이 필요해요.
apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
name: passworddepot-external-secret-example
spec:
refreshInterval: 1h0m0s
secretStoreRef:
kind: SecretStore
name: passworddepot-secret-store # Must match SecretStore on the cluster
target:
name: passworddepot-secret-to-create # Name for the secret to be created on the cluster
creationPolicy: Owner
data:
- secretKey: username # Key given to the secret to be created on the cluster
remoteRef:
key: Production.mySecret
property: login # field named in passworddepot
DataFrom 사용하기 (Using DataFrom)
DataFrom을 사용하면 변수를 JSON 문자열로 가져와 파싱을 시도할 수 있어요.
apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
name: passworddepot-external-secret-example
spec:
refreshInterval: 1h0m0s
secretStoreRef:
kind: SecretStore
name: passworddepot-secret-store # Must match SecretStore on the cluster
target:
name: passworddepot-secret-to-create # Name for the secret to be created on the cluster
creationPolicy: Owner
# each property in the secret will be used as the secret key in the SECRET k8s target object
dataFrom:
- key: "Production.mySecret" # Key of the secret
Kubernetes 시크릿 얻기 (Getting the Kubernetes secret)
오퍼레이터가 프로젝트 변수를 가져와 Kind=Secret으로 주입해요.
kubectl get secret passworddepot-secret-to-create -o jsonpath='{.data.secretKey}' | base64 -d