Dev_TIMI

EC2 Ubuntu에 kustomize 설치

by its_TIMI

kustomize

: kustomize는 쿠버네티스의 manifest 파일을 좀 더 효율적으로 관리할 수 있도록 도와주는 도구

사진에 있는 코드가 바로 쿠버네티스의 manifest 파일.

왼쪽이 base 코드, 오른쪽이 patch or overlay

만약 이 코드처럼 ldap이라는 Application을 Staging/Prod 버전으로 각각 배포? 가능

 

공식 문서 :

 

Binaries

Install Kustomize by downloading precompiled binaries.

kubectl.docs.kubernetes.io

쉘스크립트 출처:

https://github.com/tedilabs/fastcampus-devops/tree/main/3-docker-kubernetes/env/ubuntu 

 

 

 

install-kustomize.sh

#!/usr/bin/env bash
## INFO: <https://kubectl.docs.kubernetes.io/installation/kustomize/binaries/>

set -euf -o pipefail

KUSTOMIZE_VERSION=v4.4.1

# Download kustomize binary
curl -s "<https://raw.githubusercontent.com/kubernetes-sigs/kustomize/kustomize/${KUSTOMIZE_VERSION}/hack/install_kustomize.sh>"  | bash

# Install to /usr/local/bin
sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize

 

설치

install-kustomize.sh작성 및 실행권한 부여

ubuntu@ip-172-31-40-52:~$ cat > install-kustomize.sh
#!/usr/bin/env bash
## INFO: <https://kubectl.docs.kubernetes.io/installation/kustomize/binaries/>

set -euf -o pipefail

KUSTOMIZE_VERSION=v4.4.1

# Download kustomize binary
curl -s "<https://raw.githubusercontent.com/kubernetes-sigs/kustomize/kustomize/${KUSTOMIZE_VERSION}/hack/install_kustomize.sh>"  | bash

# Install to /usr/local/bin
sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize^C
ubuntu@ip-172-31-40-52:~$ chmod u+x install-kustomize.sh

설치파일(install-kustomize.sh)실행

ubuntu@ip-172-31-40-52:~$ ./install-kustomize.sh
v5.1.0
kustomize installed to /home/ubuntu/kustomize

또다시 문제! 강사님은 kustomize 입력하면 와랄라 나오는데, 나는 안나온다.

ubuntu@ip-172-31-40-52:~$ kustomize

Command 'kustomize' not found, but can be installed with:

sudo snap install kustomize

Cuz….Same Reason.

아무래도 cat > 파일명.sh 해서 입력한 뒤에 한줄 띄우고 Ctrl+C 해야하나보다. 그냥 바로 줄바꿈 없이 Ctrl+C 하니까 마지막 줄이 제대로 입력이 안된다. 아무튼, 전체 재실행은 앞과 같이 불필요하다고 판단되어 누락되었던 명령어인 sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize 만 별도로 실행 해준다.

이제 나도 강사님처럼 와랄라 잘 나온다^^,,,

ubuntu@ip-172-31-40-52:~$ kustomize

Manages declarative configuration of Kubernetes.
See <https://sigs.k8s.io/kustomize>

Usage:
  kustomize [command]

Available Commands:
  build                     Build a kustomization target from a directory or URL
  cfg                       Commands for reading and writing configuration
  completion                Generate shell completion script
  create                    Create a new kustomization in the current directory
  edit                      Edits a kustomization file
  fn                        Commands for running functions against configuration
  help                      Help about any command
  localize                  [Alpha] Creates localized copy of target kustomization root at destination
  version                   Prints the kustomize version

Flags:
  -h, --help          help for kustomize
      --stack-trace   print a stack-trace on error

Additional help topics:
  kustomize docs-fn                   [Alpha] Documentation for developing and invoking Configuration Functions.
  kustomize docs-fn-spec              [Alpha] Documentation for Configuration Functions Specification.
  kustomize docs-io-annotations       [Alpha] Documentation for annotations used by io.
  kustomize docs-merge                [Alpha] Documentation for merging Resources (2-way merge).
  kustomize docs-merge3               [Alpha] Documentation for merging Resources (3-way merge).
  kustomize tutorials-command-basics  [Alpha] Tutorials for using basic config commands.
  kustomize tutorials-function-basics [Alpha] Tutorials for using functions.

Use "kustomize [command] --help" for more information about a command.

+tmi

kubectl에도 kustomize 명령어가 있다 🧐❓❗️

ubuntu@ip-172-31-40-52:~$ kubectl kustomize
error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory '/home/ubuntu'

문법이 달라 에러가 나긴 하지만, 아무튼 있는걸 확인할 수 있다.

반응형

'Infra' 카테고리의 다른 글

EC2 Ubuntu에 kybectl설치  (0) 2023.07.27

블로그의 정보

Dev_TIMI

its_TIMI

활동하기