インストール
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s <version>
例
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s 3.6.1
{Version:kustomize/v3.6.1 GitCommit:c97fa946d576eb6ed559f17f2ac43b3b5a8d5dbd BuildDate:2020-05-27T20:47:35Z GoOs:darwin GoArch:amd64}
kustomize installed to /Users/masato-naka/repos/nakamasato/kustomize
./kustomize version
{Version:kustomize/v3.6.1 GitCommit:c97fa946d576eb6ed559f17f2ac43b3b5a8d5dbd BuildDate:2020-05-27T20:47:35Z GoOs:darwin GoArch:amd64}
例外: v3.2.1
v3.2.1 以前は、ファイルがtarでないので install_kustomize.sh内の tar xzf ./kustomize_v*_${opsys}_${arch}.tar.gz
で失敗してしまう。
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s 3.2.1
tar: Error opening archive: Failed to open './kustomize_v*_darwin_amd64.tar.gz'
v3.2.1のインストール方法
-
以下のように、スクリプトと同じようにrelease_urlをセット
release_url=https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/kustomize%2Fv3.2.1
-
OSTYPEによって
opsys
を決めるopsys=windows arch=amd64 if [[ "$OSTYPE" == linux* ]]; then opsys=linux elif [[ "$OSTYPE" == darwin* ]]; then opsys=darwin fi
-
RELEASE_URL
を githubのAPIを使って取得するRELEASE_URL=$(curl -s $release_url |\ grep -E "browser_download.*${opsys}_${arch}" |\ cut -d '"' -f 4 |\ sort -V | tail -n 1)
-
Download
curl -sLO $RELEASE_URL
-
executableに変換
chmod +x kustomize_kustomize.v3.2.1_darwin_amd64
-
チェック
./kustomize_kustomize.v3.2.1_darwin_amd64 version Version: {Version:kustomize/v3.2.1 GitCommit:d89b448c745937f0cf1936162f26a5aac688f840 BuildDate:2019-09-27T00:10:52Z GoOs:darwin GoArch:amd64}
Reference
- https://kubectl.docs.kubernetes.io/installation/kustomize/binaries/
- https://stackoverflow.com/questions/66836979/how-to-install-a-specific-kustomize-version
- https://stackoverflow.com/questions/66843181/cant-install-a-specific-kustomize-version
- https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv3.2.1