github.com/SamarSidharth/kpt@v0.0.0-20231122062228-c7d747ae3ace/site/installation/kpt-cli.md (about)

     1  # Installation
     2  
     3  Users can get kpt CLI in a variety of ways:
     4  
     5  ## Binaries
     6  
     7  Download pre-compiled binaries:
     8  
     9  - [Linux (amd64)][linux-amd64]
    10  - [Linux (arm64)][linux-arm64]
    11  - [MacOS (amd64)][darwin-amd64]
    12  - [MacOS (arm64)][darwin-arm64]
    13  
    14  Optionally verify the [SLSA3 signatures](slsa.dev) generated using the OpenSSF's [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) during the release process. To verify a release binary:
    15  1. Install the verification tool from [slsa-framework/slsa-verifier#installation](https://github.com/slsa-framework/slsa-verifier#installation).
    16  2. Download the signature file `attestation.intoto.jsonl` from the [GitHub releases page](https://github.com/GoogleContainerTools/kpt/releases).
    17  3. Run the verifier:
    18  ```shell
    19  slsa-verifier -artifact-path kpt-<os>-<arch> -provenance attestation.intoto.jsonl -source github.com/GoogleContainerTools/kpt -tag <the-tag>
    20  ```
    21  
    22  On Linux and MacOS, make it executable:
    23  
    24  ```shell
    25  $ chmod +x kpt
    26  ```
    27  
    28  ?> On MacOS the first time, it may be necessary to open the
    29  program from the finder with _ctrl-click open_.
    30  
    31  Verify the version:
    32  
    33  ```shell
    34  $ kpt version
    35  ```
    36  
    37  ## (Optional) enable shell auto-completion
    38  
    39  kpt provides auto-completion support for several of the common shells.
    40  To see the options for enabling shell auto-completion:
    41  
    42  ```shell
    43  $ kpt completion -h
    44  ```
    45  
    46  ### Prerequisites
    47  Previous installations of kpt completion may have added the following line to
    48  the shell's config file (e.g. `.bashrc`, `.zshrc`, etc.):
    49  
    50  ```shell
    51  $ complete -C <KPT_PATH> kpt
    52  ```
    53  
    54  This line needs to be removed for kpt's completion implementation to function
    55  properly.
    56  
    57  ### Enable kpt auto-completion
    58  The kpt completion script for a shell can be generated with the commands
    59  `kpt completion bash`, `kpt completion zsh`, etc.
    60  For instructions on how to enable the script for the given shell, see the help
    61  page with the commands `kpt completion bash -h`, `kpt completion zsh -h`, etc.
    62  
    63  ## gcloud
    64  
    65  Install with gcloud.
    66  
    67  ```shell
    68  $ gcloud components install kpt
    69  ```
    70  
    71  ```shell
    72  $ kpt version
    73  ```
    74  
    75  The version of kpt installed using `gcloud` may not be the latest released version, and can lag behind. Please use another installation method if you need to latest release.
    76  
    77  ## Homebrew
    78  
    79  Install the latest release with Homebrew on MacOS.
    80  
    81  ```shell
    82  $ brew tap GoogleContainerTools/kpt https://github.com/GoogleContainerTools/kpt.git
    83  $ brew install kpt
    84  ```
    85  
    86  ```shell
    87  $ kpt version
    88  ```
    89  
    90  The version of kpt installed using `brew` can only be a tagged release, master releases are not shipped.
    91  
    92  ## Docker
    93  
    94  Use one of the kpt docker images.
    95  
    96  | Feature   | `kpt` | `kpt-gcloud` |
    97  | --------- | :---: | :----------: |
    98  | kpt       |   ✓   |      ✓       |
    99  | git       |   ✓   |      ✓       |
   100  | diffutils |   ✓   |      ✓       |
   101  | gcloud    |       |      ✓       |
   102  
   103  ### `kpt`
   104  
   105  ```shell
   106  $ docker run gcr.io/kpt-dev/kpt:v1.0.0-beta.44 version
   107  ```
   108  
   109  ### `kpt-gcloud`
   110  
   111  An image which includes kpt based upon the Google [cloud-sdk] alpine image.
   112  
   113  ```shell
   114  $ docker run gcr.io/kpt-dev/kpt-gcloud:v1.0.0-beta.44 version
   115  ```
   116  
   117  ## Source
   118  
   119  Install by compiling the source. This requires having Go version 1.21+:
   120  
   121  ```shell
   122  $ go install -v github.com/GoogleContainerTools/kpt@main
   123  ```
   124  
   125  kpt version will return `unknown` for binaries built from source:
   126  
   127  ```shell
   128  $ kpt version
   129  ```
   130  
   131  [gcr.io/kpt-dev/kpt]:
   132    https://console.cloud.google.com/gcr/images/kpt-dev/GLOBAL/kpt?gcrImageListsize=30
   133  [gcr.io/kpt-dev/kpt-gcloud]:
   134    https://console.cloud.google.com/gcr/images/kpt-dev/GLOBAL/kpt-gcloud?gcrImageListsize=30
   135  [cloud-sdk]: https://github.com/GoogleCloudPlatform/cloud-sdk-docker
   136  [linux-amd64]:
   137    https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.44/kpt_linux_amd64
   138  [linux-arm64]:
   139    https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.44/kpt_linux_arm64
   140  [darwin-amd64]:
   141    https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.44/kpt_darwin_amd64
   142  [darwin-arm64]:
   143    https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.44/kpt_darwin_arm64
   144  [migration guide]: /installation/migration
   145  [bash-completion]: https://github.com/scop/bash-completion#installation