Overview
이번 포스팅에서는 Windows 환경에서 Chocolatey(Choco)를 설치한 후, 이를 활용해 OpenLens, AWS CLI, Google Cloud SDK까지 설치하는 과정을 정리하였다.
Choco는 Linux의 apt, yum에 대응하는 Windows용 패키지 관리자로, 터미널 명령어 하나로 다양한 도구들을 손쉽게 설치할 수 있게 도와준다.
OpenLens는 Kubernetes 리소스를 시각적으로 관리할 수 있는 강력한 툴로, `.kube/config` 파일만 있으면 로컬 클러스터든 클라우드 클러스터든 손쉽게 연결해 사용할 수 있다.
또한, AWS와 GCP 환경을 CLI로 다룰 수 있도록 awscli 및 gcloud sdk 설치 및 초기 세팅 과정도 함께 다루어, 클라우드 환경에서 Kubernetes 클러스터를 관리하기 위한 준비를 완성하였다.
Choco 설치
Choco는 Windows용 패키지 설치 관리자이다. 데비안의 apt나, 레드햇의 yum과 동일한 기능을 한다.
먼저 Choco를 설치하기 위해서는 먼저 PowerShell을 관리자용으로 실행해야 한다.
실행한 후 Get-ExecutionPolicy 명령을 실행한다.
Restricted 라면 Set-ExecutionPolicy AllSigned 명령을 실행한다.
그리고 Choco 설치 사이트를 방문하여 설치를 진행해준다. 아래의 명령어를 입력해주면 된다.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
그러면 아래와 같이 설치가 완료된다.
Openlens 설치
Choco 설치가 되었다면 Openlens 설치는 간단하다.
아래의 명령어로 설치를해준다.
choco install -y openlens
그리고 설치확인을 해준다.
이제 관리자 권한 말고 일반권한으로 Powershell을 실행해본다.
`C드라이브\User\<사용자>` 가 있다. 그 안에 `.kube` 폴더를 만들어준다.
그리고 `.kube` 폴더안에 `config` 파일을 넣어준다.
이제 Openlens를 실행해보자.
Openlens Extensions
awscli & gcloud sdk 설치
먼저 윈도우 Powershell을 관리자 권한으로 실행한다.
awscli 설치
choco install awscli
aws configure
choco list -l
Chocolatey v1.3.1
awscli 2.11.4
chocolatey 1.3.1
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-windowsupdate.extension 1.0.5
openlens 6.4.6
aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************ME7B shared-credentials-file
secret_key ****************Sk4V shared-credentials-file
region <not set> None None
gcloud sdk 설치
Google Cloud CLI 설치 프로그램을 다운로드한다.
또는 PowerShell 터미널을 열고 다음 PowerShell 명령어를 실행한다.
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
& $env:Temp\GoogleCloudSDKInstaller.exe
# goolge account
gcloud init
* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
* Run `gcloud cheat-sheet` to see a roster of go-to `gcloud` commands.
# google service account
gcloud auth activate-service-account --key-file=<key path>
ex. gcloud auth activate-service-account --key-file=~/.ssh/xxx.json
## 확인 ##
gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* somaz@xxxx
To set the active account, run:
$ gcloud config set account `ACCOUNT`
gcloud config configurations list
NAME IS_ACTIVE ACCOUNT PROJECT COMPUTE_DEFAULT_ZONE COMPUTE_DEFAULT_REGION
default True somaz@xxx somaz-1
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials somaz-gke --region=asia-northeast3
Fetching cluster endpoint and auth data.
kubeconfig entry generated for somaz-gke.
확인한다.
마무리
오늘은 Chocolatey를 시작으로 OpenLens, AWS CLI, GCP SDK까지 한 번에 설치하고 연동해보는 실습을 진행했다.
이제 Windows 환경에서도 터미널 기반의 설치가 굉장히 수월해졌고, OpenLens를 통해 직관적으로 리소스를 확인하고 관리할 수 있는 기반을 마련하게 되었다.
특히 `aws configure, gcloud init, gke-gcloud-auth-plugin` 등을 통한 클라우드 인증 설정까지 마치고 나면, 다양한 클러스터를 손쉽게 전환하며 실습할 수 있어 DevOps 실무에 큰 도움이 된다.
다음에는 실제 클러스터에 애플리케이션을 배포하거나, Helm이나 ArgoCD 같은 툴들과의 연동도 해보면 좋을 것 같습니다.
계속해서 환경을 확장해보며 클라우드 네이티브 경험치를 쌓아보자!
Reference
'유용한 IT Tool' 카테고리의 다른 글
VSCode Vim Extension 사용 가이드 (0) | 2024.05.17 |
---|---|
WSL 2 Docker 설치 방법 (0) | 2023.04.26 |
WSL 창 분할 창 닫기 메모 (0) | 2023.01.09 |