2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

kustomizeのversionを指定してインストール

Last updated at Posted at 2021-08-06

インストール

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のインストール方法

  1. 以下のように、スクリプトと同じようにrelease_urlをセット

    release_url=https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/kustomize%2Fv3.2.1
    
  2. OSTYPEによってopsysを決める

    opsys=windows                                
    arch=amd64
    if [[ "$OSTYPE" == linux* ]]; then
      opsys=linux
    elif [[ "$OSTYPE" == darwin* ]]; then
      opsys=darwin
    fi
    
  3. 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)
    
  4. Download

    curl -sLO $RELEASE_URL
    
  5. executableに変換

    chmod +x kustomize_kustomize.v3.2.1_darwin_amd64
    
  6. チェック

    ./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

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?