|
1 | 1 | import DependencyYaml from "../partials/replicated-sdk/_dependency-yaml.mdx" |
2 | 2 | import HelmPackage from "../partials/helm/_helm-package.mdx" |
3 | | -import Tabs from '@theme/Tabs'; |
4 | | -import TabItem from '@theme/TabItem'; |
5 | | -import HelmChartCr from "../partials/getting-started/_slackernews-chart.mdx" |
6 | | -import KotsCr from "../partials/getting-started/_slackernews-repl-app.mdx" |
7 | | -import K8sCr from "../partials/getting-started/_slackernews-k8s-app.mdx" |
8 | | -import EcCr from "../partials/getting-started/_slackernews-embedded-cluster.mdx" |
9 | | -import ConfigCr from "../partials/getting-started/_slackernews-config.mdx" |
10 | 3 | import Requirements from "../partials/embedded-cluster/_requirements.mdx" |
11 | 4 |
|
12 | 5 | # Install SlackerNews with the Helm CLI |
13 | 6 |
|
14 | | -This tutorial shows how to install a release using the Helm CLI. |
| 7 | +This topic provides a tutorial that demonstrates how to install a sample application using the Helm CLI. |
15 | 8 |
|
16 | | -## Set Up |
| 9 | +## Introduction |
17 | 10 |
|
18 | | -Get access to a cluster. |
| 11 | +This tutorial shows how to install a Helm chart distributed with Replicated using the Helm CLI. |
| 12 | + |
| 13 | +In this tutorial, you will: |
| 14 | + |
| 15 | +* Download the Helm chart for the sample application (SlackerNews) |
| 16 | + |
| 17 | +* Create a release for SlackerNews in the Replicated Platform |
| 18 | + |
| 19 | +* Access the Helm installation instructions for SlackerNews from the Replicated Enterprise Portal |
| 20 | + |
| 21 | +* Install SlackerNews using the Helm CLI in a Kubernetes cluster |
| 22 | + |
| 23 | +## Set Up Your Environment |
| 24 | + |
| 25 | +Before you begin, do the following to set up your environment: |
| 26 | + |
| 27 | +* Install the Helm CLI, which is the tool for interacting with Helm and managing Helm charts. See [Install Helm](/vendor/environment-setup#install-helm). |
| 28 | + |
| 29 | +* Ensure that you have access to a cluster that meets the requirements for Embedded Cluster: |
| 30 | + |
| 31 | + * **Option 1: Use Compatibility Matrix.** To use Replicated Compatibility Matrix to create a cluster for this tutorial, first request Compatibility Matrix credits. You can request credits by creating a Vendor Portal account and then going to [**Compatibility Matrix > Request more credits**](https://vendor.replicated.com/compatibility-matrix) in the Vendor Portal. For more information about creating an account, see [Create a Vendor Account](vendor-portal-creating-account). For more information about Compatibility Matrix credits, see [Billing and Credits](/vendor/testing-about#billing-and-credits). |
| 32 | + |
| 33 | + :::note |
| 34 | + If you are new to the Replicated platform, you might be eligible for $100 in free Compatibility Matrix credits. To request your free credits, reach out to our sales team at https://www.replicated.com/contact and note in the comments that you are completing a Replicated tutorial. |
| 35 | + ::: |
| 36 | + |
| 37 | + After you complete the prerequisites above, continue to the [Tutorial](#tutorial). You will create the cluster with Compatibility Matrix as part of the tutorial. |
| 38 | + |
| 39 | + * **Option 2: Bring your own Cluster.** |
| 40 | + |
| 41 | + For more information, see [Set Up Development Environments for Testing](/vendor/environment-setup#dev). |
19 | 42 |
|
20 | 43 | ## Tutorial |
21 | 44 |
|
22 | | -1. Create an app. |
| 45 | +1. Create an application using the Replicated CLI: |
23 | 46 |
|
24 | | -1. Get the Helm chart archive. |
| 47 | + 1. On your local machine, install the Replicated CLI: |
25 | 48 |
|
26 | | -1. Add the Replicated SDK. |
| 49 | + * MacOS |
27 | 50 |
|
28 | | -1. Add preflights. |
| 51 | + ```bash |
| 52 | + brew install replicatedhq/replicated/cli |
| 53 | + ``` |
| 54 | + * Linux / Windows Subsystem for Linux (WSL) |
| 55 | + |
| 56 | + ```bash |
| 57 | + version=$(curl -s https://api.github.com/repos/replicatedhq/replicated/releases/latest \ |
| 58 | + | grep -m1 -Po '"tag_name":\s*"v\K[^"]+') |
| 59 | + curl -Ls \ |
| 60 | + "https://github.com/replicatedhq/replicated/releases/download/v${version}/replicated_${version}_linux_amd64.tar.gz" \ |
| 61 | + -o replicated.tar.gz |
| 62 | + tar xf replicated.tar.gz replicated && rm replicated.tar.gz |
| 63 | + mv replicated /usr/local/bin/replicated |
| 64 | + ``` |
| 65 | + For more information and additional installation options, see [Install the Replicated CLI](/reference/replicated-cli-installing). |
| 66 | + |
| 67 | + 1. Authorize the Replicated CLI: |
| 68 | + |
| 69 | + ```bash |
| 70 | + replicated login |
| 71 | + ``` |
| 72 | + In the browser window that opens, follow the prompt to log in to your Vendor Portal account and authorize the CLI. |
| 73 | + |
| 74 | + 1. Create an application named `SlackerNews`: |
| 75 | + |
| 76 | + ```bash |
| 77 | + replicated app create SlackerNews |
| 78 | + ``` |
| 79 | + |
| 80 | + 1. Set the `REPLICATED_APP` environment variable to the application that you created: |
| 81 | + |
| 82 | + ```bash |
| 83 | + export REPLICATED_APP=APP_SLUG |
| 84 | + ``` |
| 85 | + Where `APP_SLUG` is the unique application slug provided in the output of the `app create` command. |
| 86 | + |
| 87 | + Setting the `REPLICATED_APP` environment variable allows you to interact with the application using the Replicated CLI without needing to use the `--app` flag with every command. |
| 88 | + |
| 89 | +1. Get the sample SlackerNews Helm chart: |
| 90 | + |
| 91 | + 1. Run the following command to download version 1.0.0 of the sample SlackerNews Helm chart to a new `quick-start` directory: |
| 92 | + |
| 93 | + ``` |
| 94 | + curl -O --create-dirs --output-dir quick-start https://docs.replicated.com/slackernews-1.0.0.tar.gz |
| 95 | + ``` |
| 96 | + |
| 97 | + 1. Untar the chart: |
| 98 | + |
| 99 | + ``` |
| 100 | + tar -xzf quick-start/slackernews-1.0.0.tar.gz -C quick-start/ && rm quick-start/slackernews-1.0.0.tar.gz |
| 101 | + ``` |
| 102 | + |
| 103 | + 1. Change to the `slackernews` chart directory: |
| 104 | + |
| 105 | + ```bash |
| 106 | + cd quick-start/chart/slackernews |
| 107 | + ``` |
| 108 | + |
| 109 | + 1. List the files in the `slackernews` directory to view the contents of the Helm chart: |
| 110 | + ```bash |
| 111 | + ls |
| 112 | + ``` |
| 113 | + ```bash |
| 114 | + Chart.lock Chart.yaml NOTES.txt README.md templates values.yaml |
| 115 | + ``` |
| 116 | + |
| 117 | + 1. In the SlackerNews Helm chart `Chart.yaml`, add the Replicated SDK as a dependency: |
| 118 | + |
| 119 | + <DependencyYaml/> |
| 120 | + |
| 121 | + The Replicated SDK is a Helm chart that provides access to Replicated features and can be installed as a small service alongside your application. For more information, see [About the Replicated SDK](/vendor/replicated-sdk-overview). |
| 122 | + |
| 123 | + adds preflight checks to the application: |
| 124 | + |
| 125 | + 1. In your local filesystem, go to the `quick-start/chart/slackernews` directory. |
| 126 | + |
| 127 | + 1. Create a `preflights.yaml` file in the `templates` directory for the chart: |
| 128 | + |
| 129 | + ``` |
| 130 | + touch templates/preflights.yaml |
| 131 | + ``` |
| 132 | + |
| 133 | + 1. In the `preflights.yaml` file, add the following YAML to create a Kubernetes Secret with a simple preflight spec: |
| 134 | + |
| 135 | + ```yaml |
| 136 | + apiVersion: v1 |
| 137 | + kind: Secret |
| 138 | + metadata: |
| 139 | + name: slackernews-preflight |
| 140 | + labels: |
| 141 | + troubleshoot.sh/kind: preflight |
| 142 | + stringData: |
| 143 | + preflight.yaml: |- |
| 144 | + apiVersion: troubleshoot.sh/v1beta2 |
| 145 | + kind: Preflight |
| 146 | + metadata: |
| 147 | + name: slackernews-preflight |
| 148 | + spec: |
| 149 | + collectors: |
| 150 | + - clusterInfo: {} |
| 151 | + - clusterResources: {} |
| 152 | + - http: |
| 153 | + collectorName: slack |
| 154 | + get: |
| 155 | + url: https://api.slack.com/methods/api.test |
| 156 | + timeout: 20s |
| 157 | + analyzers: |
| 158 | + # verify that slack is accessible |
| 159 | + - textAnalyze: |
| 160 | + checkName: Slack Accessible |
| 161 | + fileName: slack.json |
| 162 | + regex: '"status": 200,' |
| 163 | + outcomes: |
| 164 | + - pass: |
| 165 | + when: "true" |
| 166 | + message: "Can access the Slack API" |
| 167 | + - fail: |
| 168 | + when: "false" |
| 169 | + message: "Cannot access the Slack API. Check that the server can reach the internet and check [status.slack.com](https://status.slack.com)." |
| 170 | + ``` |
| 171 | + |
| 172 | + The YAML above defines a preflight check that confirms that an HTTP request to the Slack API at `https://api.slack.com/methods/api.test` made from the cluster returns a successful response of `"status": 200,`. |
| 173 | + |
| 174 | + 1. In the `Chart.yaml` file, increment the version to 1.0.1: |
| 175 | + |
| 176 | + ```yaml |
| 177 | + # Chart.yaml |
| 178 | + version: 1.0.1 |
| 179 | + ``` |
| 180 | + |
| 181 | + 1. Update dependencies and package the Helm chart to a `.tgz` chart archive: |
| 182 | + |
| 183 | + ```bash |
| 184 | + helm package --dependency-update . |
| 185 | + ``` |
| 186 | + Where `--dependency-update` (or `-u`) is an option for the `helm package` command that updates chart dependencies before packaging. For more information, see [Helm Package](https://helm.sh/docs/helm/helm_package/) in the Helm documentation. |
| 187 | + |
| 188 | + The output of this command is a file named `slackernews-1.0.0.tgz`. |
29 | 189 |
|
30 | 190 | 1. Add the chart to a new release with `replicated release create --yaml-dir . --promote Unstable`. |
31 | 191 |
|
|
0 commit comments