iT邦幫忙

2022 iThome 鐵人賽

DAY 15
0
DevOps

從零開始的Kubernetes轉換系列 第 15

Day 15 argo cd 和 sops generator

  • 分享至 

  • xImage
  •  

昨天提到sops和kustomize的結合,免不了的我們也要讓argo CD可以利用sops generator來讓argo cd有能力部署我們加密過的kustomize檔

首先我們要把gcp service account的credential放入gke中,
在IAM我們有設定過service account然後下載key,然後下以下command

kubectl create secret generic gcp-credential --from-file <your gcp credential name>.json -n argo

然後我們更改data/argo-value.yaml

server:
  config:
    kustomize.buildOptions: "--enable-alpha-plugins"
  replicas: 2

repoServer:
  replicas: 2
  volumes:
    - name: custom-tools
      emptyDir: {}
    - name: gcp-credential
      secret:
        secretName: gcp-credential
  volumeMounts:
    - mountPath: /.config/kustomize/plugin/goabout.com/v1beta1/sopssecretgenerator/SopsSecretGenerator
      name: custom-tools
      subPath: SopsSecretGenerator
    - mountPath: /.secrets/gcp/ServiceAccount.json
      name: gcp-credential
      subPath: key.json
  env:
    - name: XDG_CONFIG_HOME
      value: /.config
    - name: GOOGLE_APPLICATION_CREDENTIALS
      value: /.secrets/gcp/ServiceAccount.json

  initContainers:
    - name: install-goaboutsops
      image: alpine:3.11.3
      command: ["/bin/sh", "-c"]
      args:
        - echo "Installing goabout kustomize sops...";
          set -e;
          set -x;
          wget -O /custom-tools/SopsSecretGenerator https://github.com/goabout/kustomize-sopssecretgenerator/releases/download/v${VERSION}/SopsSecretGenerator_${VERSION}_${PLATFORM}_${ARCH};
          chmod -v +x /custom-tools/SopsSecretGenerator;
          set +x;
          echo "Done.";
      volumeMounts:
        - mountPath: /custom-tools
          name: custom-tools
      env:
        - name: VERSION
          value: 1.6.0
        - name: PLATFORM
          value: linux
        - name: ARCH
          value: amd64

之後 terraform apply就可以看到repo server deployment的變動


上一篇
Day 14 讓 sops 與 kustomize 結合
下一篇
Day 16 argo CD 登入
系列文
從零開始的Kubernetes轉換30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言