Tanzu Kubernetes Grid 1.3.1 on Microsoft Azure

업데이트:

Deploy Tanzu Kubernetes Grid 1.3.1 on Microsoft Azure

JumpBox Ubuntu 20.04 기준 작성

Install the Tanzu CLI and Other Tools

Prerequisites

  1. GUI Interface가 있는 Bootstrap Machine
  2. 최소 사양 : 6GB RAM & 2core CPU (Linux)
  3. 시스템 시간은 NTP 서버 동기화
  4. Bootstrap Machine은 로컬 물리적 Machine이 아닌 Cloud VM
    • 급한대로 vSphere JumpBox 구성하여 진행
  5. Linux에서 Tanzu CLI를 실행하려면 root 계정이 아닌, 사용자 계정을 docker group에 추가
    • docker.sock 접근하기 위함

Download and Unpack the Tanzu CLI and kubectl

The tanzu CLI ships with a compatible version of the kubectl CLI. To download and unpack both

  1. https://my.vmware.com 이동하고 My VMware 자격 증명으로 로그인
  2. Tanzu Kubernetes Grid 다운로드 페이지 이동
  3. VMware Tanzu Kubernetes Grid “GO TO DOWNLOADS” 이동
  4. Select Version에서 1.3.1 선택
  5. Product Downloads에서 VMware Tanzu CLI 1.3.1 CLILinux Download
  6. Kubectl 1.20.5 for VMware Tanzu Kubernetes Grid 1.3.1에서 Linux Download
  7. 계정 home 디렉토리에 tanzu 디렉토리 생성 및 다운로드 파일 복사

     [ubuntu@JumpBox01 ~]$ ls
     공개  다운로드  문서  바탕화면  비디오  사진  음악  템플릿
     [ubuntu@JumpBox01 ~]$ mkdir tanzu
     [ubuntu@JumpBox01 ~]$ cd tanzu
     [ubuntu@JumpBox01 ~/tanzu]$ ls -al
     합계 527736
     drwxrwxr-x  2 ubuntu ubuntu      4096  7월  5 14:07 .
     drwxr-xr-x 16 ubuntu ubuntu      4096  7월  5 14:05 ..
     -rw-rw-r--  1 ubuntu ubuntu  11940803  7월  5 14:07 kubectl-linux-v1.20.5-vmware.1.gz
     -rw-rw-r--  1 ubuntu ubuntu 528445440  7월  5 14:07 tanzu-cli-bundle-v1.3.1-linux-amd64.tar
     [ubuntu@JumpBox01 ~/tanzu]$
    
  8. 압축 해제
    • tar xvf tanzu-cli-bundle-v1.3.1-linux-amd64.tar
    • gunzip kubectl-linux-v1.20.5-vmware.1.gz

Install the Tanzu CLI

  1. tanzu/cli 이동
  2. 시스템에서 CLI 사용
    • binary를 /usr/local/bin 위치에 설치
       $ sudo install core/v1.3.1/tanzu-core-linux_amd64 /usr/local/bin/tanzu
    
    • e.g.

        [ubuntu@JumpBox01 ~/tanzu/cli]$ sudo install core/v1.3.1/tanzu-core-linux_amd64     /usr/local/bin/tanzu
        [sudo] ubuntu의 암호:
        [ubuntu@JumpBox01 ~/tanzu/cli]$
      
  3. tanzu version을 입력하여 CLI 정상 설치 여부 확인

     $ tanzu version
    
    • e.g.

        [ubuntu@JumpBox01 ~/tanzu/cli]$ tanzu version
        version: v1.3.1
        buildDate: 2021-05-07
        sha: e5c37c4
        [ubuntu@JumpBox01 ~/tanzu/cli]$
      

Install the Tanzu CLI Plugins

  1. 기존 plugin 제거

     $ tanzu plugin clean
    
  2. tanzu 디렉토리로 이동 (cli 디렉토리 포함)
    • e.g.
       [ubuntu@JumpBox01 ~/tanzu]$ pwd
       /home/ubuntu/tanzu
       [ubuntu@JumpBox01 ~/tanzu]$ ls
       cli  kubectl-linux-v1.20.5-vmware.1  tanzu-cli-bundle-v1.3.1-linux-amd64.tar
       [ubuntu@JumpBox01 ~/tanzu]$
    
  3. tanzu release의 모든 plugin 설치

     $ tanzu plugin install --local cli all
    
    • e.g.

        [ubuntu@JumpBox01 ~/tanzu]$ tanzu plugin install --local cli all
        [ubuntu@JumpBox01 ~/tanzu]$
      
  4. plugin 설치 확인

     $ tanzu plugin list
    
    • e.g.

        [ubuntu@JumpBox01 ~/tanzu]$ tanzu plugin list
        NAME                LATEST VERSION  DESCRIPTION                                                        REPOSITORY  VERSION  STATUS         
         alpha               v1.3.1          Alpha CLI commands                                                 core                 not installed  
         cluster             v1.3.1          Kubernetes cluster operations                                      core        v1.3.1   installed      
         kubernetes-release  v1.3.1          Kubernetes release operations                                      core        v1.3.1   installed      
         login               v1.3.1          Login to the platform                                              core        v1.3.1   installed      
         management-cluster  v1.3.1          Kubernetes management cluster operations                           core        v1.3.1   installed      
         pinniped-auth       v1.3.1          Pinniped authentication operations (usually not directly invoked)  core        v1.3.1   installed      
        [ubuntu@JumpBox01 ~/tanzu]$
      

Install kubectl

  1. 위의 kubectl-linux-v1.20.5-vmware.1.gz 압축 해제한 디렉토리 이동
    • e.g.
       [ubuntu@JumpBox01 ~]$ cd /home/ubuntu/tanzu
       [ubuntu@JumpBox01 ~/tanzu]$ ls
       cli  kubectl-linux-v1.20.5-vmware.1  tanzu-cli-bundle-v1.3.1-linux-amd64.tar
       [ubuntu@JumpBox01 ~/tanzu]$
    
  2. 시스템에서 CLI 사용
    • binary를 /usr/local/bin 위치에 설치
       $ sudo install kubectl-linux-v1.20.5-vmware.1 /usr/local/bin/kubectl
    
    • e.g.

        [ubuntu@JumpBox01 ~/tanzu]$ sudo install kubectl-linux-v1.20.5-vmware.1 /usr/local/bin/kubectl
        [ubuntu@JumpBox01 ~/tanzu]$ /usr/local/bin/kubectl version
        Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5+vmware.1", GitCommit:"f4553304874c3b89584280a5ac1b005d57c725a8", GitTreeState:"clean", BuildDate:"2021-03-22T17:00:59Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
        The connection to the server localhost:8080 was refused - did you specify the right host or port?
        [ubuntu@JumpBox01 ~/tanzu]$
      

Install the Carvel Tools

Tanzu Kubernetes Grid는 Carvel 오픈 소스 프로젝트 의 다음 도구를 사용

  1. cli 디렉토리로 이동
  2. ytt
    • 압축 해제 및 /usr/local/bin으로 복사
    • e.g.
       $ gunzip ytt-linux-amd64-v0.31.0+vmware.1.gz
       $ chmod ugo+x ytt-linux-amd64-v0.31.0+vmware.1
       $ sudo cp ytt-linux-amd64-v0.31.0+vmware.1 /usr/local/bin/ytt
    
  3. kapp
    • 압축 해제 및 /usr/local/bin으로 복사
    • e.g.
       $ gunzip kapp-linux-amd64-v0.36.0+vmware.1.gz
       $ chmod ugo+x kapp-linux-amd64-v0.36.0+vmware.1
       $ sudo cp kapp-linux-amd64-v0.36.0+vmware.1 /usr/local/bin/kapp
    
  4. kbld
    • 압축 해제 및 /usr/local/bin으로 복사
    • e.g.
       $ gunzip kbld-linux-amd64-v0.28.0+vmware.1.gz
       $ chmod ugo+x kbld-linux-amd64-v0.28.0+vmware.1
       $ sudo cp kbld-linux-amd64-v0.28.0+vmware.1 /usr/local/bin/kbld
    
  5. imgpkg
    • 압축 해제 및 /usr/local/bin으로 복사
    • e.g.
       $ gunzip imgpkg-linux-amd64-v0.5.0+vmware.1.gz
       $ chmod ugo+x imgpkg-linux-amd64-v0.5.0+vmware.1
       $ sudo cp imgpkg-linux-amd64-v0.5.0+vmware.1 /usr/local/bin/imgpkg
    

Prepare to Deploy Management Clusters to Microsoft Azure

Tanzu Kubernetes Grid를 Azure 클라이언트 앱으로 등록

  1. Azure Portal 로그인
  2. tenant id
    • portal.azure.com -> azure active directory 검색 -> 테넌트 정보 -> 테넌트 ID
  3. client id
    • active directory -> 앱등록 -> tanzu -> 애플리케이션(클라이언트) ID
  4. subscription id
    • azure home -> 구독 -> 구독ID
  5. client secret
    • active directory -> 앱등록 -> tanzu -> 인증서 및 암호 -> 새 클라이언트 암호 -> 클라이언트 암호 추가

기본 이미지 라이센스 동의

  1. bootstrap machine에서 azure cli 로그인

     $ az login --service-principal --username $AZURE_CLIENT_ID --password $AZURE_CLIENT_SECRET --tenant $AZURE_TENANT_ID
    

Create an SSH Key Pair

  1. bootstrap machine에서 ssh-keygen command 활용

     $ ssh-keygen -t rsa -b 4096 -C "jongha0212@gmail.com"
    
  2. SSH 에이전트에 개인 키를 추가

     $ ssh-add ~/.ssh/id_rsa
    
    • 에러 발생 시 : Could not open a connection to your authentication agent.

        root@JumpBox01:~/.ssh# ssh-add ~/.ssh/id_rsa
        Could not open a connection to your authentication agent.
        root@JumpBox01:~/.ssh# eval $(ssh-agent)
        Agent pid 180371
        root@JumpBox01:~/.ssh# ssh-add ~/.ssh/id_rsa
        Identity added: /root/.ssh/id_rsa (jongha0212@gmail.com)
        root@JumpBox01:~/.ssh#
      

Deploy Management Clusters with the Installer Interface

  1. tanzu management-cluster create –ui –bind 192.168.230.21:5555 –browser none

댓글남기기