본문 바로가기

VMware/TANZU

(DK) TKGM에서 각 MASTER 및 NODE에 TRUST CA 설정

728x90

## 설치시 YTT에 YAML 추가

참고링크

### 미리 생성한 CA를 아래 폴더로 이동.
cp /data/cert/ca.crt ~/.tanzu/tkg/providers/infrastructure-azure/ytt/tkg-custom-ca.pem

### YTT 폴더에 맨 밑에 아래 수정
cd ~/.tanzu/tkg/providers/infrwastructure-IAAS/ytt/IAAS-overlay.yaml

IAAS = { AWS or AZURE or vSphere }


vi ~/.tanzu/tkg/providers/infrastructure-azure/ytt/azure-overlay.yaml
#@overlay/match by=overlay.subset({"kind":"KubeadmConfigTemplate"}),expects="1+"
---
spec:
  #@overlay/match missing_ok=True
  template:
    spec:
      #@overlay/match missing_ok=True
      files:
        #@overlay/append
        - content: #@ data.read("tkg-custom-ca.pem")
          owner: root:root
          permissions: "0644"
          path: /etc/ssl/certs/tkg-custom-ca.pem            
      #@overlay/match missing_ok=True
      preKubeadmCommands:
      #@overlay/append
      - "if [ -f /etc/kubernetes/azure.json ]; then sed -i 's/\"vmType\": \"vmss\"/\"vmType\": \"standard\"/' /etc/kubernetes/azure.json; fi"
      #! For Photon OS (Ubuntu 사용시 삭제)
      #@overlay/append
      - '! which rehash_ca_certificates.sh 2>/dev/null || rehash_ca_certificates.sh'
      #! For Ubuntu OS 사용 (Phothon 사용시 삭제)
      #@overlay/append
      - '! which update-ca-certificates 2>/dev/null || (mv /etc/ssl/certs/tkg-custom-ca.pem /usr/local/share/ca-certificates/tkg-custom-ca.crt && update-ca-certificates)'

#@overlay/match by=overlay.subset({"kind":"KubeadmControlPlane"})
---
spec:
  #@overlay/match missing_ok=True
  kubeadmConfigSpec:
    #@overlay/match missing_ok=True
    files:
      #@overlay/append
      - content: #@ data.read("tkg-custom-ca.pem")
        owner: root:root
        permissions: "0644"
        path: /etc/ssl/certs/tkg-custom-ca.pem          
    #@overlay/match missing_ok=True
    preKubeadmCommands:
    #@overlay/append
    - "if [ -f /etc/kubernetes/azure.json ]; then sed -i 's/\"vmType\": \"vmss\"/\"vmType\": \"standard\"/' /etc/kubernetes/azure.json; fi"
    #! For Photon OS (Ubuntu 사용시 삭제)
    #@overlay/append
    - '! which rehash_ca_certificates.sh 2>/dev/null || rehash_ca_certificates.sh'
    #! For Ubuntu OS 사용 (Phothon 사용시 삭제)
    #@overlay/append
    - '! which update-ca-certificates 2>/dev/null || (mv /etc/ssl/certs/tkg-custom-ca.pem /usr/local/share/ca-certificates/tkg-custom-ca.crt && update-ca-certificates)'
반응형