Skip to content

Commit

Permalink
Install stash cli using krew (#108)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha authored Oct 21, 2020
1 parent ebf67e5 commit 3a33f3f
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ The setup section contains instructions for installing the Stash and its various
- **Uninstall Stash:** Uninstallation instructions for Stash and its various components.
- [Community Edition](/docs/setup/uninstall/community.md): Uninstallation instructions for Stash Community Edition.
- [Enterprise Edition](/docs/setup/uninstall/enterprise.md): Uninstallation instructions for Stash Enterprise Edition.
- [Stash kubectl Plugin](/docs/setup/uninstall/kubectl_plugin.md): Uninstallation instructions for Stash `kubectl` plugin.
- [Upgrading Stash](/docs/setup/upgrade.md): Instruction for updating Stash license and upgrading between various Stash versions.
61 changes: 52 additions & 9 deletions docs/setup/install/kubectl_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,65 @@ menu_name: docs_{{ .version }}
section_menu_id: setup
---

## Install Stash kubectl Plugin
# Install Stash kubectl Plugin

Stash provides a `kubectl` plugin to interact with Stash resources. You can download the pre-build binaries from [stashed/cli](https://github.com/stashed/cli/releases) releases and put it into one of your installation directory denoted by `$PATH` variable.
Stash provides a `kubectl` plugin to interact with Stash resources.

## Install using Krew

Stash `kubectl` plugin can be installed using Krew. [Krew](https://krew.sigs.k8s.io/) is the plugin manager for kubectl command-line tool. To install follow the steps below:

- Install `krew` following the steps [here](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).

- If you have already installed `krew`, please upgrade `krew` to version v0.4.0 or later so that you can use [custom plugin indexes](https://krew.sigs.k8s.io/docs/user-guide/custom-indexes/).

```bash
kubectl krew upgrade
kubectl krew version
```

- Add [AppsCode's kubectl plugin index](https://github.com/appscode/krew-index). If you have already added the index, update the index.

```bash
kubectl krew index add appscode https://github.com/appscode/krew-index.git
kubectl krew index list
kubectl krew update
```

- Install Stash `kubectl` plugin following the commands below:

```bash
kubectl krew install appscode/stash
kubectl stash version
```

- If Stash `kubectl` plugin is already installed, run the following command to upgrade the plugin:

```bash
kubectl krew upgrade
kubectl stash version
```

## Install using pre-built binary

You can download the pre-build binaries from [stashed/cli](https://github.com/stashed/cli/releases) releases and put it into one of your installation directory denoted by `$PATH` variable.

Here is a simple Linux command to install the latest 64-bit Linux binary directly into your `/usr/local/bin` directory:

```bash
# Linux amd 64-bit
wget -O kubectl-stash https://github.com/stashed/cli/releases/download/{{< param "info.cli" >}}/kubectl-stash-linux-amd64 \
&& chmod +x kubectl-stash \
&& sudo mv kubectl-stash /usr/local/bin/
curl -o kubectl-stash.tar.gz -fsSL https://github.com/stashed/cli/releases/download/{{< param "info.cli" >}}/kubectl-stash-linux-amd64.tar.gz \
&& tar zxvf kubectl-stash.tar.gz \
&& chmod +x kubectl-stash-linux-amd64 \
&& sudo mv kubectl-stash-linux-amd64 /usr/local/bin/kubectl-stash \
&& rm kubectl-stash.tar.gz LICENSE.md

# Mac OSX 64-bit
wget -O kubectl-stash https://github.com/stashed/cli/releases/download/{{< param "info.cli" >}}/kubectl-stash-darwin-amd64 \
&& chmod +x kubectl-stash \
&& sudo mv kubectl-stash /usr/local/bin/
curl -o kubectl-stash.tar.gz -fsSL https://github.com/stashed/cli/releases/download/{{< param "info.cli" >}}/kubectl-stash-darwin-amd64.tar.gz \
&& tar zxvf kubectl-stash.tar.gz \
&& chmod +x kubectl-stash-darwin-amd64 \
&& sudo mv kubectl-stash-darwin-amd64 /usr/local/bin/kubectl-stash \
&& rm kubectl-stash.tar.gz LICENSE.md
```

If you prefer to install kubectl Stash cli from source code, make sure that your go development environment has been setup properly. Then, just run:
Expand All @@ -36,4 +79,4 @@ If you prefer to install kubectl Stash cli from source code, make sure that your
go get github.com/stashed/cli/...
```

>Please note that this will install kubectl stash cli from master branch which might include breaking and/or undocumented changes.
>Please note that this will install Stash cli from master branch which might include breaking and/or undocumented changes.
23 changes: 23 additions & 0 deletions docs/setup/uninstall/kubectl_plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Uninstall Stash kubectl Plugin
description: Uninstallation guide for Stash kubectl Plugin
menu:
docs_{{ .version }}:
identifier: uninstall-stash-kubectl-plugin
name: Stash kubectl Plugin
parent: uninstallation-guide
weight: 30
product_name: stash
menu_name: docs_{{ .version }}
section_menu_id: setup
---

# Uninstall Stash kubectl Plugin

## Uninstall using Krew

To uninstall Stash `kubectl` plugin, run the following command:

```bash
kubectl krew uninstall stash
```

0 comments on commit 3a33f3f

Please sign in to comment.