From 7091db321d69bd47ef91020fa11f44f48f752b9d Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 8 Sep 2020 23:57:14 +0300 Subject: [PATCH 1/4] Add kubectl setup guide --- docs/guides/kubectl-setup.md | 35 +++++++++++++++++++++++++++++++++++ docs/summary.md | 1 + 2 files changed, 36 insertions(+) create mode 100644 docs/guides/kubectl-setup.md diff --git a/docs/guides/kubectl-setup.md b/docs/guides/kubectl-setup.md new file mode 100644 index 0000000000..c58293f93c --- /dev/null +++ b/docs/guides/kubectl-setup.md @@ -0,0 +1,35 @@ +# Set up kubectl + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +Since Cortex is built on top of Kubernetes, you can get more granular control over your Cortex cluster by interacting with the `kubectl` CLI. + +The following are the steps required to get `kubectl` set up for your existing Cortex cluster. This will only apply to Linux/Mac machines as the Cortex CLI was built for these OSes. + +## Step 1 + +Install `eksctl` by following these [instructions](https://eksctl.io/introduction/#installation). Don't forget to have the AWS credentials set too. + +## Step 2 + +Install `kubectl` by following these [instructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/). + +## Step 3 + +Run the following command. + +```bash +eksctl utils write-kubeconfig --cluster= --region= +``` + +Where `` is the name of your cluster as specified in `cluster.yaml` and with `` being the region of the cluster, still as it was specified in the `cluster.yaml` config. + +## Step 4 + +Test `kubectl` against the existing Cortex cluster by running a command like the following. + +```bash +kubectl get pods + + +``` diff --git a/docs/summary.md b/docs/summary.md index e812ea07c6..e0d3b4b16e 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -70,6 +70,7 @@ * [Set up VPC peering](guides/vpc-peering.md) * [SSH into worker instance](guides/ssh-instance.md) * [Single node deployment](guides/single-node-deployment.md) +* [Set up kubectl](guides/kubectl-setup.md) ## Contributing From fe49496c042f9fbf49346b1771b3931e40e98438 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Wed, 9 Sep 2020 00:22:14 +0300 Subject: [PATCH 2/4] Tweak the kubectl setup guide --- docs/guides/kubectl-setup.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/guides/kubectl-setup.md b/docs/guides/kubectl-setup.md index c58293f93c..c31b109022 100644 --- a/docs/guides/kubectl-setup.md +++ b/docs/guides/kubectl-setup.md @@ -4,7 +4,7 @@ _WARNING: you are on the master branch, please refer to the docs on the branch t Since Cortex is built on top of Kubernetes, you can get more granular control over your Cortex cluster by interacting with the `kubectl` CLI. -The following are the steps required to get `kubectl` set up for your existing Cortex cluster. This will only apply to Linux/Mac machines as the Cortex CLI was built for these OSes. +The following are the steps required to get `kubectl` set up for your existing Cortex cluster. ## Step 1 @@ -16,20 +16,28 @@ Install `kubectl` by following these [instructions](https://kubernetes.io/docs/t ## Step 3 -Run the following command. +Run the following command. Your output can be different. ```bash -eksctl utils write-kubeconfig --cluster= --region= +$ eksctl utils write-kubeconfig --cluster= --region= + +[ℹ] eksctl version 0.19.0-rc.1 +[ℹ] using region us-east-1 +[✔] saved kubeconfig as "/home/robert/.kube/config" ``` Where `` is the name of your cluster as specified in `cluster.yaml` and with `` being the region of the cluster, still as it was specified in the `cluster.yaml` config. ## Step 4 -Test `kubectl` against the existing Cortex cluster by running a command like the following. +Test `kubectl` against the existing Cortex cluster by running a command like the following. Your output will be different. ```bash -kubectl get pods - +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +cloudwatch-agent-statsd-flwmv 1/1 Running 0 6m16s +fluentd-bv8xl 1/1 Running 0 6m20s +fluentd-vrwhw 1/1 Running 0 6m20s +operator-dc489b4f9-mmwkz 1/1 Running 0 6m14s ``` From c59e0b3234f68affcbeb645924cd7d1b35bf6b92 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Wed, 9 Sep 2020 00:24:51 +0300 Subject: [PATCH 3/4] Add comment at the end of the guide --- docs/guides/kubectl-setup.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guides/kubectl-setup.md b/docs/guides/kubectl-setup.md index c31b109022..6ec1b7aec2 100644 --- a/docs/guides/kubectl-setup.md +++ b/docs/guides/kubectl-setup.md @@ -41,3 +41,5 @@ fluentd-bv8xl 1/1 Running 0 6m20s fluentd-vrwhw 1/1 Running 0 6m20s operator-dc489b4f9-mmwkz 1/1 Running 0 6m14s ``` + +Kubectl is now set up! From 149406dc5a74c6b57da326e31001460fcc4d34e6 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 8 Sep 2020 14:55:51 -0700 Subject: [PATCH 4/4] Update kubectl-setup.md --- docs/guides/kubectl-setup.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/guides/kubectl-setup.md b/docs/guides/kubectl-setup.md index 6ec1b7aec2..d91a2f18e5 100644 --- a/docs/guides/kubectl-setup.md +++ b/docs/guides/kubectl-setup.md @@ -2,31 +2,31 @@ _WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ -Since Cortex is built on top of Kubernetes, you can get more granular control over your Cortex cluster by interacting with the `kubectl` CLI. +Although it is not necessary to use `kubectl` to interact with Cortex clusters, advanced users can use `kubectl` to get more granular visibility into the cluster (since Cortex is built on top of Kubernetes). -The following are the steps required to get `kubectl` set up for your existing Cortex cluster. +Here's how to set up `kubectl` and connect it to your existing Cortex cluster: ## Step 1 -Install `eksctl` by following these [instructions](https://eksctl.io/introduction/#installation). Don't forget to have the AWS credentials set too. +Install `kubectl` by following these [instructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/). ## Step 2 -Install `kubectl` by following these [instructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/). +Install `eksctl` by following these [instructions](https://eksctl.io/introduction/#installation). ## Step 3 -Run the following command. Your output can be different. +Make sure that your AWS credentials are available in your current shell environment. `eksctl` will search for credentials in the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables, or your `aws` CLI's credentials file (which can be created with `aws configure`). + +## Step 4 + +Run the following command: ```bash $ eksctl utils write-kubeconfig --cluster= --region= - -[ℹ] eksctl version 0.19.0-rc.1 -[ℹ] using region us-east-1 -[✔] saved kubeconfig as "/home/robert/.kube/config" ``` -Where `` is the name of your cluster as specified in `cluster.yaml` and with `` being the region of the cluster, still as it was specified in the `cluster.yaml` config. +Where `` is the name of your cluster and `` is the region of the cluster. These were specified when your cluster was created, either via command line prompts or your cluster configuration file (e.g. `cluster.yaml`). The default cluster name is `cortex`, and the default region is `us-east-1`. ## Step 4 @@ -42,4 +42,4 @@ fluentd-vrwhw 1/1 Running 0 6m20s operator-dc489b4f9-mmwkz 1/1 Running 0 6m14s ``` -Kubectl is now set up! +`kubectl` is now configured!