VSO 설치

VSO 설치 (Install Vault Secrets Operator)

Helm 또는 Kustomize로 Vault Secrets Operator를 설치·업그레이드하는 방법을 다룹니다.

출처: 문서

본문

사전 요구사항 (Prerequisites)

  • 1.23+ 쿠버네티스 클러스터
  • Helm 3.7+
  • [선택] Kustomize 4.5.7+

Helm으로 설치

시작하기 전에 Helm을 설치하세요.

Helm 차트는 Vault Secrets Operator를 설치·구성하는 권장 방법이에요.

Vault Secrets Operator의 새 인스턴스를 설치하려면 먼저 HashiCorp Helm 레포지토리를 추가하고 차트에 접근할 수 있는지 확인해요.

$ helm repo add hashicorp https://helm.releases.hashicorp.com
"hashicorp" has been added to your repositories
$ helm search repo hashicorp/vault-secrets-operator
NAME            CHART VERSION   APP VERSION DESCRIPTION
hashicorp/vault-secrets-operator    1.5.0           1.5.0       Official HashiCorp Vault Secrets Operator Chart

그런 다음 Operator를 설치해요.

$ helm install --version 1.5.0 --create-namespace --namespace vault-secrets-operator vault-secrets-operator hashicorp/vault-secrets-operator

CSI 드라이버 옵션

Vault Secrets Operator Helm 차트를 사용해 "csi.enabled" 플래그로 Vault Secrets Operator CSI 드라이버의 DaemonSet을 배포할 수도 있어요.

$ helm install                          \
    --version 1.5.0                    \
    --create-namespace                  \
    --namespace vault-secrets-operator  \
    --set "csi.enabled=true"            \
    vault-secrets-operator              \
    hashicorp/vault-secrets-operator

CSI 드라이버로 시크릿을 애플리케이션 파드에 직접 마운트하는 방법은 Vault Secrets Operator CSI 드라이버 문서를 참고하세요.

Helm 사용 시 CRD 업데이트

중요해요. VSO 0.8.0부터 VSO는 CRD를 자동으로 업데이트합니다. 아래의 수동 업그레이드 단계(Updating CRDs)는 VSO 0.8.0+로 업그레이드하기 전에는 더 이상 필요하지 않아요.

Helm으로 업그레이드

helm upgrade 명령으로 기존 설치를 업그레이드할 수 있어요. 설치나 업그레이드 전에는 항상 --dry-run 옵션으로 Helm을 실행해 변경 사항을 확인해 주세요.

hashicorp Helm 레포지토리를 업데이트해요.

$ helm repo update hashicorp
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "hashicorp" chart repository
Update Complete. ⎈Happy Helming!⎈

VSO 릴리스를 업그레이드하려면 <TARGET_VSO_VERSION>을 업그레이드할 VSO 버전으로 바꾸세요.

$ helm upgrade --version <TARGET_VSO_VERSION> --namespace vault-secrets-operator vault-secrets-operator hashicorp/vault-secrets-operator

예를 들어 VSO 1.5.0으로 업그레이드한다면:

$ helm upgrade --version 1.5.0 --namespace vault-secrets-operator vault-secrets-operator hashicorp/vault-secrets-operator

VSO Helm 차트는 배포되는 VSO 버전에 맞게 CRD를 자동으로 업그레이드해요. Helm으로 VSO를 업그레이드하기 전에 CRD를 수동으로 업데이트할 필요는 없을 거예요.

차트 값 (Chart values)

지원되는 전체 차트 값 목록은 Helm 차트 개요를 참고하세요.

Kustomize로 설치

kustomize로 설치·업데이트할 수 있는데, 이를 통해 Kustomize 프리미티브로 VSO 레포지토리의 config/ 경로를 확장할 수 있어요.

Kustomize로 설치하려면 Releases Page에서 최신 릴리스를 다운로드해 압축을 풀어요.

$ wget -q https://github.com/hashicorp/vault-secrets-operator/archive/refs/tags/v1.5.0.tar.gz
$ tar -zxf v1.5.0.tar.gz
$ cd vault-secrets-operator-1.5.0/

다음으로 kustomize build로 설치해요.

$ kustomize build config/default | kubectl apply -f -
namespace/vault-secrets-operator-system created
customresourcedefinition.apiextensions.k8s.io/hcpauths.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/hcpvaultsecretsapps.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/vaultauths.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/vaultconnections.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/vaultdynamicsecrets.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/vaultpkisecrets.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/vaultstaticsecrets.secrets.hashicorp.com created
serviceaccount/vault-secrets-operator-controller-manager created
role.rbac.authorization.k8s.io/vault-secrets-operator-leader-election-role created
clusterrole.rbac.authorization.k8s.io/vault-secrets-operator-manager-role created
clusterrole.rbac.authorization.k8s.io/vault-secrets-operator-metrics-reader created
clusterrole.rbac.authorization.k8s.io/vault-secrets-operator-proxy-role created
rolebinding.rbac.authorization.k8s.io/vault-secrets-operator-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/vault-secrets-operator-manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/vault-secrets-operator-proxy-rolebinding created
configmap/vault-secrets-operator-manager-config created
service/vault-secrets-operator-controller-manager-metrics-service created
deployment.apps/vault-secrets-operator-controller-manager created

파드를 살펴보며 operator가 설치됐는지 확인해요.

$ kubectl get pods -n vault-secrets-operator-system
NAMESPACE                       NAME                                                         READY   STATUS    RESTARTS   AGE
vault-secrets-operator-system   vault-secrets-operator-controller-manager-56754d5496-cq69s   2/2     Running   0          1m17s

Kustomize는 Helm 차트의 모든 기능을 지원하지 않아요. 특히 기본 VaultAuthMethod, VaultConnection 또는 Transit 관련 리소스를 배포하지 않아요. 또 Kustomize는 Helm 차트가 언인스톨 경로에서 리소스를 정리하고 finalizer를 제거할 때 사용하는 pre-delete 훅도 지원하지 않습니다. 추가 리소스는 config/samples 또는 다운로드한 릴리스 산출물의 config/samples를 참고하세요.

Kustomize로 업그레이드

Kustomize로 업그레이드하는 것은 설치와 비슷해요. github에서 새 릴리스를 다운로드해 Kustomize로 설치에 설명된 것과 같은 단계를 따르면 됩니다. CRD를 업데이트하는 데 추가 단계는 필요 없어요.

레거시 참고 사항

다음 참고 사항은 이전 버전의 VSO를 설치/업그레이드할 때의 지침을 제공해요.

VSO 0.8.0 이전: Helm 사용 시 CRD 업데이트

VSO 0.8.0 이상으로 업그레이드한다면 이 단계는 건너뛸 수 있어요.

Helm은 CRD를 자동으로 업데이트하지 않아요. 0.8.0 이전 버전으로 VSO를 업그레이드하기 전에 모든 CRD를 수동으로 업데이트해야 해요.

Operator가 Helm으로 관리될 때는 operator를 업그레이드하기 전에 VSO의 CRD를 수동으로 업데이트해야 합니다.

last-applied-configuration과 관련된 kubectl 경고는 무시해도 안전합니다.

VSO CRD를 업데이트하려면 <TARGET_VSO_VERSION>을 업그레이드할 VSO 버전으로 바꾸세요.

$ helm show crds --version <TARGET_VSO_VERSION> hashicorp/vault-secrets-operator | kubectl apply -f -

예를 들어 VSO 0.7.1로 업그레이드한다면:

$ helm show crds --version 0.7.1 hashicorp/vault-secrets-operator | kubectl apply -f -

customresourcedefinition.apiextensions.k8s.io/hcpauths.secrets.hashicorp.com created
customresourcedefinition.apiextensions.k8s.io/hcpvaultsecretsapps.secrets.hashicorp.com created
Warning: resource customresourcedefinitions/vaultauths.secrets.hashicorp.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/vaultauths.secrets.hashicorp.com configured
Warning: resource customresourcedefinitions/vaultconnections.secrets.hashicorp.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/vaultconnections.secrets.hashicorp.com configured
Warning: resource customresourcedefinitions/vaultdynamicsecrets.secrets.hashicorp.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/vaultdynamicsecrets.secrets.hashicorp.com configured
Warning: resource customresourcedefinitions/vaultpkisecrets.secrets.hashicorp.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/vaultpkisecrets.secrets.hashicorp.com configured
Warning: resource customresourcedefinitions/vaultstaticsecrets.secrets.hashicorp.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/vaultstaticsecrets.secrets.hashicorp.com configured

더 알아보기 (Learn more)