๋ฆฌ๋ ์ค์ KIND ์ค์นํ๊ธฐ w/golang
- kkumtree
2024-09-02T00:33:19+09:00
Helm ์ค์น ์ถ๊ฐ
CloudNet@์์ ์งํํ๊ณ ์๋ K8s Advanced Network Study(์ดํ, KANS)์ ์ฐธ์ฌํ๊ฒ ๋๋ฉด์ ๊ธฐ๋ก์ ๋จ๊ธฐ๊ณ ์์ต๋๋ค.
์ด๋ฒ์๋ kind(Kubernetes IN Docker)๋ฅผ Golang์ ํตํด ์ค์นํ๋ฉด์ ์ฝ๊ฐ์ ์?๋์ด ์์๋ ๋ถ๋ถ๋ง ๋ค๋ฃน๋๋ค.
1. KIND๋?
- ์๋ ์ฌ์ง์ผ๋ก ๋์ฒดํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ Docs/Initial_design์์ ๋ณผ์ ์์ต๋๋ค.

2. KIND ์ค์นํ๊ธฐ
- Docs/Quick-start๋ฅผ ์ฐธ๊ณ ํฉ๋๋ค.
Linux์ ๊ฒฝ์ฐ, ํจํค์ง ๊ด๋ฆฌ์ ์ค์น๊ฐ ์์ด ๋ฐ์ด๋๋ฆฌ, ํน์ ์์ค๋ก ์ค์นํด์ผ ํฉ๋๋ค.
์๋ ๋ ๋ฌธ์ฅ์ ๋ญ๊ฐ ๋ฐ๋ํ์ฌ Go ์ธ์ด๋ก ์ค์น๋ฅผ ํด๋ณด๊ธฐ๋ก ํ์ต๋๋ค.
If you are a go developer you may find the go install option convenient.
Otherwise we supply downloadable release binaries, community-managed packages, and a source installation guide.
3. ์ค์น๋ ๋งค์ฐ ๊ฐ๋จ
- Go ๊ฐ๋ฐ์๋ ์๋์ง๋ง, ์ ๊น๋ ค์์๊ณ ๊ทธ GOPATH ํ๊ฒฝ๋ณ์๋ ํ์ธ๋ฉ๋๋ค. ๋ฌด์จ์ผ์ด๋.
โฏ go version
go version go1.22.2 linux/amd64
โฏ go env GOPATH
/home/kkumtree/go
- Docs๋ฅผ ์ ์ฝ๊ณ , ์๋์ ๊ฐ์ด ์ค์นํ๋ฉด ๋ฉ๋๋ค.
go install sigs.k8s.io/[email protected]
4. ์ด๊ฑธ๋ก ๋ ์ผ๋ฆฌ๊ฐ ์๋ค. ํ๊ฒฝ๋ณ์ ์ค์
- ๊ทธ๋ฐ ๊ฑด ์กด์ฌํ์ง ์์ต๋๋ค. Go๋ฅผ ๊ฐ๋ฐ์ ์ฌ์ฉํด๋ณธ ์ ์ด ์์ผ๋ฉด ์๋์ฒ๋ผ Go ๋ฐ์ด๋๋ฆฌ๊ฐ PATH ํ๊ฒฝ๋ณ์์ ์ค์ ํฉ๋๋ค.
โฏ env | grep go
PATH=/home/kkumtree/go/bin:/home/kkumtree/.tfenv/bin:/home/kkumtree/.tfenv/bin:/home/kkumtree/.tfenv/bin:/home/kkumtree/.sdkman/candidates/java/current/bin:/home/kkumtree/.nvm/versions/node/v18.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
(a์) ~/.bashrc์ ์ ์ ์ง์
- ๋ณดํต ์ด๋ ๊ฒํ๋ฉด, ์ฌ์ฉํ๋๋ฐ ๋ณ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
echo 'export PATH=$PATH:/home/kkumtree/go/bin' >> ~/.bashrc
# zsh์ผ ๊ฒฝ์ฐ) exec bash
source ~/.bashrc
# zsh์ผ ๊ฒฝ์ฐ, ๋ค์ zsh๋ก ๋ณต๊ท) exec zsh
(b์) ~/.profile์ ๋์ ์ง์
- ๋ณ๋ค๋ฅธ ์ด์ ๋ ์๊ณ , profile์ ์กฐ๊ฑด ์ค์ ์ด ๋์ด์์ด์ ์ถ๊ฐํด๋ณด์์ต๋๋ค.
- ๋ง์ง๋ง 3์ค๋ง ์ถ๊ฐ๋ก ์์ฑ
# โฏ cat ~/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# set PATH so it includes user's gopath if it exists
if [ -x "/usr/bin/go" ] && [ -d "$(/usr/bin/go env GOPATH)/bin" ] ; then
PATH="$(/usr/bin/go env GOPATH)/bin:$PATH"
fi
source ~/.profile๋ก ์ ์ฉํ ํ, kind version์ผ๋ก ์ค์น ํ์ธ.