์œˆ๋„์šฐ์—์„œ operator-sdk ์‚ฌ์šฉ ํ™˜๊ฒฝ ๊ตฌ์ถ• (wsl, Ubuntu 22.04)

์œˆ๋„์šฐ์—์„œ operator-sdk cli๋ฅผ ์‚ฌ์šฉํ•ด๋ณด๊ธฐ ์œ„ํ•œ ํ™˜๊ฒฝ ๊ตฌ์ถ• ๊ณผ์ •์ž…๋‹ˆ๋‹ค.

brew install์ด๋ฉด ๋˜๋Š” ๋งฅ์ด ์•„๋‹Œ ์œˆ๋„์šฐ ์œ ์ €๋“ค์„ ์œ„ํ•ด ์ž‘์„ฑํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค (๋ˆˆ๋ฌผ)

 

OS

์œˆ๋„์šฐ11

 

๋‹ค์šด๋กœ๋“œ

wsl

Ubuntu 22.04 (MS Store์—์„œ ๋‹ค์šด)

 

๋‹ค์šด๋กœ๋“œ ๋ถ€๋ถ„๋ถ€ํ„ฐ๋Š” wsl์—์„œ code . ์œผ๋กœ vscode๋กœ ๋“ค์–ด๊ฐ€์„œ ์ง„ํ–‰ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

go ๋‹ค์šด๋กœ๋“œ

apt ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ €๋ฅผ ํ†ตํ•ด ๋‹ค์šด ๋ฐ›์„ ๊ฒฝ์šฐ ๋ฒ„์ „์ด 1.18๋กœ ๊น”๋ฆฝ๋‹ˆ๋‹ค.

์ตœ์‹  ๋ฒ„์ „์„ ๋ฐ›๊ธฐ ์œ„ํ•ด ์ˆ˜๋™ ์„ค์น˜๋กœ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค

apt-get update
apt-get install -y wget

# root ๊ถŒํ•œ์œผ๋กœ ์ง„ํ–‰
apt-get update
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
tar -xvf go1.21.0.linux-amd64.tar.gz
mv go /usr/local

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

source ~/.profile

# Go ์„ค์น˜ ํ™•์ธ
go version

 

operator-sdk ๋‹ค์šด๋กœ๋“œ

git clone https://github.com/operator-framework/operator-sdk

cd operator-sdk

make build
make install

 

๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋”ฐ๋ผํ–ˆ๋Š”๋ฐ build๊นŒ์ง„ ๋˜์ง€๋งŒ install์ด ์•ˆ๋˜๋”๋ผ๊ตฌ์š”;;

์—ฌ๊ธฐ์„œ make install์„ ํ•˜๋ฉด wsl์—์„œ ์•„๋ž˜ ์—๋Ÿฌ๋ฅผ ๋งˆ์ฃผํ•ฉ๋‹ˆ๋‹ค.

์—๋Ÿฌ๋ฅผ ํ•ด์„ํ•ด๋ณด๋ฉด GOBIN ๊ณ  ๋ฐ”์ด๋„ˆ๋ฆฌ๊ฐ€ ์ •์˜๋˜์ง€ ์•Š์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ •๋ง์ธ์ง€ ํ™•์ธํ•˜๊ณ ์ž ํ•˜๋ฉด go env๋ฅผ ํ†ตํ•ด GOBIN์ด ๊ฐ’์ด ์•„๋ฌด๊ฒƒ๋„ ์ง€์ •์ด ์•ˆ๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹น์—ฐํ•ฉ๋‹ˆ๋‹ค. export๋ฅผ ์œ„์—์„œ ์•ˆํ–ˆ๊ธฐ ๋•Œ๋ฌธ์ด๊ฒ ์ฃ  ์ž๋™์œผ๋กœ ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋Š” ์ค„ ์•Œ์•˜๋‹ต๋‹ˆ๋‹ค ํ•˜ํ•˜

export GOBIN=$HOME/go/bin

GOBIN๋„ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ์ •์ƒ์ ์œผ๋กœ make install์ด ์ง„ํ–‰๋จ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (์œˆ๋„์šฐ ์œ ์ €๋„ ํŽธํ•˜๊ฒŒ ์“ฐ๊ณ ์‹ถ๋‹คGO)

operator-sdk version์ด ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ์•„๋ฆ„๋‹ค์šด ๊ฒฐ๊ณผ๋ฌผ์ž…๋‹ˆ๋‹ค.

 

 

์ฐธ๊ณ  ๋ฌธ์„œ

https://sdk.operatorframework.io/docs/installation/

 

Installation

Install the Operator SDK CLI

sdk.operatorframework.io

https://play-with-go.dev/installing-go_go119_en/

 

Installing Go

Congratulations! Great work! you are getting closer and closer to archieving your goals. Go foward!

play-with-go.dev