From 8c95be965aa82b5a7ecf310d3149eb9ea311b5d1 Mon Sep 17 00:00:00 2001 From: lucperkins Date: Thu, 21 Jun 2018 17:00:30 -0700 Subject: [PATCH 1/6] Syntax fixes for Cassandra doc --- .../stateful-application/cassandra.md | 144 +++++++++++------- 1 file changed, 87 insertions(+), 57 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index fc9b617cdf4..4f1f2829fd2 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -19,14 +19,14 @@ The docker image above is based on [debian-base](https://github.com/kubernetes/k | ENV VAR | DEFAULT VALUE | | ------------- |:-------------: | -| CASSANDRA_CLUSTER_NAME | 'Test Cluster' | -| CASSANDRA_NUM_TOKENS | 32 | -| CASSANDRA_RPC_ADDRESS | 0.0.0.0 | +| `CASSANDRA_CLUSTER_NAME` | `'Test Cluster'` | +| `CASSANDRA_NUM_TOKENS` | `32` | +| `CASSANDRA_RPC_ADDRESS` | `0.0.0.0` | {{% /capture %}} {{% capture objectives %}} -* Create and Validate a Cassandra headless [Services](/docs/concepts/services-networking/service/). +* Create and validate a Cassandra headless [Service](/docs/concepts/services-networking/service/). * Use a [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) to create a Cassandra ring. * Validate the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/). * Modify the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/). @@ -49,17 +49,18 @@ To complete this tutorial, you should already have a basic familiarity with [Pod ### Additional Minikube Setup Instructions {{< caution >}} -**Caution:** [Minikube](/docs/getting-started-guides/minikube/) defaults to 1024MB of memory and 1 CPU which results in an insufficient resource errors during this tutorial. +**Caution:** [Minikube](/docs/getting-started-guides/minikube/) defaults to 1024MB of memory and 1 CPU. Running Minikube with the default resource configuration may result in insufficient resource errors during this tutorial. To avoid these errors, we recommend running Minikube with 5 GB of memory and 4 CPUs: + +```bash +minikube start --memory 5120 --cpus=4 +``` {{< /caution >}} - -To avoid these errors, run minikube with: - - minikube start --memory 5120 --cpus=4 {{% /capture %}} {{% capture lessoncontent %}} ## Creating a Cassandra Headless Service + A Kubernetes [Service](/docs/concepts/services-networking/service/) describes a set of [Pods](/docs/concepts/workloads/pods/pod/) that perform the same task. The following `Service` is used for DNS lookups between Cassandra Pods and clients within the Kubernetes Cluster. @@ -67,7 +68,9 @@ The following `Service` is used for DNS lookups between Cassandra Pods and clien 1. Launch a terminal window in the directory you downloaded the manifest files. 2. Create a `Service` to track all Cassandra StatefulSet Nodes from the `cassandra-service.yaml` file: - kubectl create -f cassandra-service.yaml + ```bash + kubectl create -f cassandra-service.yaml + ``` {{< code file="cassandra/cassandra-service.yaml" >}} @@ -75,14 +78,18 @@ The following `Service` is used for DNS lookups between Cassandra Pods and clien Get the Cassandra `Service`. - kubectl get svc cassandra +```bash +kubectl get svc cassandra +``` The response should be - NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE - cassandra None 9042/TCP 45s +``` +NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE +cassandra None 9042/TCP 45s +``` -If anything else returns, the service was not successfully created. Read [Debug Services](/docs/tasks/debug-application-cluster/debug-service/) for common issues. +If anything else is returned, the Service was not successfully created. Read [Debug Services](/docs/tasks/debug-application-cluster/debug-service/) for common issues. ## Using a StatefulSet to Create a Cassandra Ring @@ -95,7 +102,9 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 1. Update the StatefulSet if necessary. 2. Create the Cassandra StatefulSet from the `cassandra-statefulset.yaml` file: - kubectl create -f cassandra-statefulset.yaml + ```bash + kubectl create -f cassandra-statefulset.yaml + ``` {{< code file="cassandra/cassandra-statefulset.yaml" >}} @@ -103,57 +112,70 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 1. Get the Cassandra StatefulSet: - kubectl get statefulset cassandra + ```bash + kubectl get statefulset cassandra + ``` - The response should be + The response should be: - NAME DESIRED CURRENT AGE - cassandra 3 0 13s + ``` + NAME DESIRED CURRENT AGE + cassandra 3 0 13s + ``` The StatefulSet resource deploys Pods sequentially. 2. Get the Pods to see the ordered creation status: - kubectl get pods -l="app=cassandra" + ```bash + kubectl get pods -l="app=cassandra" + ``` - The response should be + The response should be: - NAME READY STATUS RESTARTS AGE - cassandra-0 1/1 Running 0 1m - cassandra-1 0/1 ContainerCreating 0 8s + ```bash + NAME READY STATUS RESTARTS AGE + cassandra-0 1/1 Running 0 1m + cassandra-1 0/1 ContainerCreating 0 8s + ``` - {{< note >}} - **Note:** It can take up to ten minutes for all three Pods to deploy. - {{< /note >}} + Please note that it may take several minutes for all three Pods to deploy. Once they are deployed, the same command returns: - Once all Pods are deployed, the same command returns: + ``` + NAME READY STATUS RESTARTS AGE + cassandra-0 1/1 Running 0 10m + cassandra-1 1/1 Running 0 9m + cassandra-2 1/1 Running 0 8m + ``` - NAME READY STATUS RESTARTS AGE - cassandra-0 1/1 Running 0 10m - cassandra-1 1/1 Running 0 9m - cassandra-2 1/1 Running 0 8m +3. Run the Cassandra [nodetool](https://wiki.apache.org/cassandra/NodeTool) to display the status of the ring. -3. Run the Cassandra utility nodetool to display the status of the ring. + ```bash + kubectl exec -it cassandra-0 -- nodetool status + ``` - kubectl exec cassandra-0 -- nodetool status + The response should look something like this: - The response is: - - Datacenter: DC1-K8Demo - ====================== - Status=Up/Down - |/ State=Normal/Leaving/Joining/Moving - -- Address Load Tokens Owns (effective) Host ID Rack - UN 172.17.0.5 83.57 KiB 32 74.0% e2dd09e6-d9d3-477e-96c5-45094c08db0f Rack1-K8Demo - UN 172.17.0.4 101.04 KiB 32 58.8% f89d6835-3a42-4419-92b3-0e62cae1479c Rack1-K8Demo - UN 172.17.0.6 84.74 KiB 32 67.1% a6a1e8c2-3dc5-4417-b1a0-26507af2aaad Rack1-K8Demo + ``` + Datacenter: DC1-K8Demo + ====================== + Status=Up/Down + |/ State=Normal/Leaving/Joining/Moving + -- Address Load Tokens Owns (effective) Host ID Rack + UN 172.17.0.5 83.57 KiB 32 74.0% e2dd09e6-d9d3-477e-96c5-45094c08db0f Rack1-K8Demo + UN 172.17.0.4 101.04 KiB 32 58.8% f89d6835-3a42-4419-92b3-0e62cae1479c Rack1-K8Demo + UN 172.17.0.6 84.74 KiB 32 67.1% a6a1e8c2-3dc5-4417-b1a0-26507af2aaad Rack1-K8Demo + ``` ## Modifying the Cassandra StatefulSet + Use `kubectl edit` to modify the size of a Cassandra StatefulSet. 1. Run the following command: - kubectl edit statefulset cassandra + ```bash + kubectl edit statefulset cassandra + ``` This command opens an editor in your terminal. The line you need to change is the `replicas` field. @@ -186,12 +208,16 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. 3. Get the Cassandra StatefulSet to verify: - kubectl get statefulset cassandra + ```bash + kubectl get statefulset cassandra + ``` - The response should be + The response should be - NAME DESIRED CURRENT AGE - cassandra 4 4 36m + ``` + NAME DESIRED CURRENT AGE + cassandra 4 4 36m + ``` {{% /capture %}} @@ -199,20 +225,24 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. Deleting or scaling a StatefulSet down does not delete the volumes associated with the StatefulSet. This ensures safety first: your data is more valuable than an auto purge of all related StatefulSet resources. {{< warning >}} -**Warning:** Depending on the storage class and reclaim policy, deleting the Persistent Volume Claims may cause the associated volumes to also be deleted. Never assume you’ll be able to access data if its volume claims are deleted. +**Warning:** Depending on the storage class and reclaim policy, deleting the PersistentVolumeClaims may cause the associated volumes to also be deleted. Never assume you’ll be able to access data if its volume claims are deleted. {{< /warning >}} -1. Run the following commands to delete everything in a `StatefulSet`: +1. Run the following commands (chained together into a single command) to delete everything in the Cassandra StatefulSet: - grace=$(kubectl get po cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \ - && kubectl delete statefulset -l app=cassandra \ - && echo "Sleeping $grace" \ - && sleep $grace \ - && kubectl delete pvc -l app=cassandra + ```bash + grace=$(kubectl get po cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \ + && kubectl delete statefulset -l app=cassandra \ + && echo "Sleeping $grace" \ + && sleep $grace \ + && kubectl delete pvc -l app=cassandra + ``` 2. Run the following command to delete the Cassandra `Service`. - kubectl delete service -l app=cassandra + ```bash + kubectl delete service -l app=cassandra + ``` {{% /capture %}} From 3edad5889f390b27a202d8295a06c2c058be4867 Mon Sep 17 00:00:00 2001 From: lucperkins Date: Mon, 25 Jun 2018 10:54:12 -0700 Subject: [PATCH 2/6] Fix indentation issues --- .../stateful-application/cassandra.md | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index 4f1f2829fd2..07129079494 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -123,7 +123,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists cassandra 3 0 13s ``` - The StatefulSet resource deploys Pods sequentially. + The StatefulSet resource deploys Pods sequentially. 2. Get the Pods to see the ordered creation status: @@ -177,30 +177,32 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. kubectl edit statefulset cassandra ``` - This command opens an editor in your terminal. The line you need to change is the `replicas` field. + This command opens an editor in your terminal. The line you need to change is the `replicas` field. - {{< note >}} - **Note:** The following sample is an excerpt of the StatefulSet file. - {{< /note >}} + {{< note >}} + **Note:** The following sample is an excerpt of the StatefulSet file. + {{< /note >}} - # Please edit the object below. Lines beginning with a '#' will be ignored, - # and an empty file will abort the edit. If an error occurs while saving this file will be - # reopened with the relevant failures. - # - apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 - kind: StatefulSet - metadata: - creationTimestamp: 2016-08-13T18:40:58Z - generation: 1 - labels: - app: cassandra - name: cassandra - namespace: default - resourceVersion: "323" - selfLink: /apis/apps/v1/namespaces/default/statefulsets/cassandra - uid: 7a219483-6185-11e6-a910-42010a8a0fc0 - spec: - replicas: 3 + ```yaml + # Please edit the object below. Lines beginning with a '#' will be ignored, + # and an empty file will abort the edit. If an error occurs while saving this file will be + # reopened with the relevant failures. + # + apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 + kind: StatefulSet + metadata: + creationTimestamp: 2016-08-13T18:40:58Z + generation: 1 + labels: + app: cassandra + name: cassandra + namespace: default + resourceVersion: "323" + selfLink: /apis/apps/v1/namespaces/default/statefulsets/cassandra + uid: 7a219483-6185-11e6-a910-42010a8a0fc0 + spec: + replicas: 3 + ``` 2. Change the number of replicas to 4, and then save the manifest. @@ -253,4 +255,3 @@ Deleting or scaling a StatefulSet down does not delete the volumes associated wi {{% /capture %}} - From 2e2ba426671d71cb2c18dea370a22d4a1855601c Mon Sep 17 00:00:00 2001 From: lucperkins Date: Wed, 27 Jun 2018 09:49:06 -0700 Subject: [PATCH 3/6] convert unnecessary note admonition to normal text --- content/en/docs/tutorials/stateful-application/cassandra.md | 6 +----- src/sass/styles.sass | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index 07129079494..af90766417d 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -177,11 +177,7 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. kubectl edit statefulset cassandra ``` - This command opens an editor in your terminal. The line you need to change is the `replicas` field. - - {{< note >}} - **Note:** The following sample is an excerpt of the StatefulSet file. - {{< /note >}} + This command opens an editor in your terminal. The line you need to change is the `replicas` field. The following sample is an excerpt of the StatefulSet file: ```yaml # Please edit the object below. Lines beginning with a '#' will be ignored, diff --git a/src/sass/styles.sass b/src/sass/styles.sass index 9f31e944e1c..d140ad68106 100755 --- a/src/sass/styles.sass +++ b/src/sass/styles.sass @@ -4,4 +4,4 @@ // media queries @import "base" @import "tablet" -@import "desktop" +@import "desktop" \ No newline at end of file From 3ffa3bc8af28ed02206cc6b3f1cd518b01e154c1 Mon Sep 17 00:00:00 2001 From: lucperkins Date: Wed, 25 Jul 2018 15:41:34 -0700 Subject: [PATCH 4/6] s/bash/shell (revert to previous) --- .../stateful-application/cassandra.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index 941a8c4a855..64b182ec641 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -9,7 +9,7 @@ weight: 30 {{% capture overview %}} This tutorial shows you how to develop a native cloud [Cassandra](http://cassandra.apache.org/) deployment on Kubernetes. In this example, a custom Cassandra `SeedProvider` enables Cassandra to discover new Cassandra nodes as they join the cluster. -It can be challenging to deploy stateful distributed applications like Cassandra within a clustered environment. StatefulSets greatly simplify this process. Please read about [StatefulSets](/docs/concepts/workloads/controllers/statefulset/) for more information about the features used in this tutorial. +It can be challenging to deploy stateful distributed applications within a clustered environment. StatefulSets greatly simplify this process. See the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) documentation for more information on the features used in this tutorial. **Cassandra on Docker** @@ -56,7 +56,7 @@ To complete this tutorial, you should already have a basic familiarity with [Pod {{< caution >}} **Caution:** [Minikube](/docs/getting-started-guides/minikube/) defaults to 1024MB of memory and 1 CPU. Running Minikube with the default resource configuration may result in insufficient resource errors during this tutorial. To avoid these errors, we recommend running Minikube with 5 GB of memory and 4 CPUs: -```bash +```shell minikube start --memory 5120 --cpus=4 ``` {{< /caution >}} @@ -75,7 +75,7 @@ The following `Service` is used for DNS lookups between Cassandra Pods and clien 1. Launch a terminal window in the directory you downloaded the manifest files. 1. Create a `Service` to track all Cassandra StatefulSet Nodes from the `cassandra-service.yaml` file: - ```bash + ```shell kubectl create -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml ``` @@ -83,7 +83,7 @@ The following `Service` is used for DNS lookups between Cassandra Pods and clien Get the Cassandra `Service`. -```bash +```shell kubectl get svc cassandra ``` @@ -109,7 +109,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 1. Update the StatefulSet if necessary. 1. Create the Cassandra StatefulSet from the `cassandra-statefulset.yaml` file: - ```bash + ```shell kubectl create -f https://k8s.io/examples/application/cassandra/cassandra-statefulset.yaml ``` @@ -117,7 +117,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 1. Get the Cassandra StatefulSet: - ```bash + ```shell kubectl get statefulset cassandra ``` @@ -132,13 +132,13 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 1. Get the Pods to see the ordered creation status: - ```bash + ```shell kubectl get pods -l="app=cassandra" ``` The response should be: - ```bash + ```shell NAME READY STATUS RESTARTS AGE cassandra-0 1/1 Running 0 1m cassandra-1 0/1 ContainerCreating 0 8s @@ -155,7 +155,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists 3. Run the Cassandra [nodetool](https://wiki.apache.org/cassandra/NodeTool) to display the status of the ring. - ```bash + ```shell kubectl exec -it cassandra-0 -- nodetool status ``` @@ -178,7 +178,7 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. 1. Run the following command: - ```bash + ```shell kubectl edit statefulset cassandra ``` @@ -211,7 +211,7 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. 1. Get the Cassandra StatefulSet to verify: - ```bash + ```shell kubectl get statefulset cassandra ``` @@ -233,7 +233,7 @@ Deleting or scaling a StatefulSet down does not delete the volumes associated wi 1. Run the following commands (chained together into a single command) to delete everything in the Cassandra StatefulSet: - ```bash + ```shell grace=$(kubectl get po cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \ && kubectl delete statefulset -l app=cassandra \ && echo "Sleeping $grace" \ @@ -243,7 +243,7 @@ Deleting or scaling a StatefulSet down does not delete the volumes associated wi 1. Run the following command to delete the Cassandra `Service`. - ```bash + ```shell kubectl delete service -l app=cassandra ``` From 788cb238adb52e963e6d75d222c8592f8d3ceb0c Mon Sep 17 00:00:00 2001 From: lucperkins Date: Wed, 25 Jul 2018 15:42:33 -0700 Subject: [PATCH 5/6] More language fixes --- content/en/docs/tutorials/stateful-application/cassandra.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index 64b182ec641..ca094a5bb26 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -87,14 +87,14 @@ Get the Cassandra `Service`. kubectl get svc cassandra ``` -The response should be +The response is ``` NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE cassandra None 9042/TCP 45s ``` -If anything else is returned, the Service was not successfully created. Read [Debug Services](/docs/tasks/debug-application-cluster/debug-service/) for common issues. +Service creation failed if anything else is returned. Read [Debug Services](/docs/tasks/debug-application-cluster/debug-service/) for common issues. ## Using a StatefulSet to Create a Cassandra Ring From 7164d5be1eb3c4d33fcb91adef01bc1a283b3459 Mon Sep 17 00:00:00 2001 From: lucperkins Date: Fri, 27 Jul 2018 16:03:27 -0700 Subject: [PATCH 6/6] Standardize code formatting --- .../stateful-application/cassandra.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/content/en/docs/tutorials/stateful-application/cassandra.md b/content/en/docs/tutorials/stateful-application/cassandra.md index ca094a5bb26..c4d580da952 100644 --- a/content/en/docs/tutorials/stateful-application/cassandra.md +++ b/content/en/docs/tutorials/stateful-application/cassandra.md @@ -9,11 +9,11 @@ weight: 30 {{% capture overview %}} This tutorial shows you how to develop a native cloud [Cassandra](http://cassandra.apache.org/) deployment on Kubernetes. In this example, a custom Cassandra `SeedProvider` enables Cassandra to discover new Cassandra nodes as they join the cluster. -It can be challenging to deploy stateful distributed applications within a clustered environment. StatefulSets greatly simplify this process. See the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) documentation for more information on the features used in this tutorial. +`StatefulSet`s make it easier to deploy stateful applications within a clustered environment. For more information on the features used in this tutorial, see the [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/) documentation. **Cassandra on Docker** -The Pods use the [`gcr.io/google-samples/cassandra:v13`](https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile) +The `Pod`s in this tutorial use the [`gcr.io/google-samples/cassandra:v13`](https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile) image from Google's [container registry](https://cloud.google.com/container-registry/docs/). The Docker image above is based on [debian-base](https://github.com/kubernetes/kubernetes/tree/master/build/debian-base) and includes OpenJDK 8. @@ -30,22 +30,22 @@ By using environment variables you can change values that are inserted into `cas {{% /capture %}} {{% capture objectives %}} -* Create and validate a Cassandra headless [Service](/docs/concepts/services-networking/service/). -* Use a [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) to create a Cassandra ring. -* Validate the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/). -* Modify the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/). -* Delete the [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) and its [Pods](/docs/concepts/workloads/pods/pod/). +* Create and validate a Cassandra headless [`Service`](/docs/concepts/services-networking/service/). +* Use a [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/) to create a Cassandra ring. +* Validate the [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/). +* Modify the [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/). +* Delete the [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/) and its [`Pod`s](/docs/concepts/workloads/pods/pod/). {{% /capture %}} {{% capture prerequisites %}} -To complete this tutorial, you should already have a basic familiarity with [Pods](/docs/concepts/workloads/pods/pod/), [Services](/docs/concepts/services-networking/service/), and [StatefulSets](/docs/concepts/workloads/controllers/statefulset/). In addition, you should: +To complete this tutorial, you should already have a basic familiarity with [`Pod`s](/docs/concepts/workloads/pods/pod/), [`Service`s](/docs/concepts/services-networking/service/), and [`StatefulSet`s](/docs/concepts/workloads/controllers/statefulset/). In addition, you should: -* [Install and Configure](/docs/tasks/tools/install-kubectl/) the `kubectl` command line +* [Install and Configure](/docs/tasks/tools/install-kubectl/) the `kubectl` command-line tool -* Download [cassandra-service.yaml](/examples/application/cassandra/cassandra-service.yaml) - and [cassandra-statefulset.yaml](/examples/application/cassandra/cassandra-statefulset.yaml) +* Download [`cassandra-service.yaml`](/examples/application/cassandra/cassandra-service.yaml) + and [`cassandra-statefulset.yaml`](/examples/application/cassandra/cassandra-statefulset.yaml) -* Have a supported Kubernetes Cluster running +* Have a supported Kubernetes cluster running {{< note >}} **Note:** Please read the [getting started guides](/docs/setup/pick-right-solution/) if you do not already have a cluster. @@ -66,14 +66,14 @@ minikube start --memory 5120 --cpus=4 {{% capture lessoncontent %}} ## Creating a Cassandra Headless Service -A Kubernetes [Service](/docs/concepts/services-networking/service/) describes a set of [Pods](/docs/concepts/workloads/pods/pod/) that perform the same task. +A Kubernetes [`Service`](/docs/concepts/services-networking/service/) describes a set of [`Pod`s](/docs/concepts/workloads/pods/pod/) that perform the same task. -The following `Service` is used for DNS lookups between Cassandra Pods and clients within the Kubernetes Cluster. +The following `Service` is used for DNS lookups between Cassandra `Pod`s and clients within the Kubernetes cluster. {{< codenew file="application/cassandra/cassandra-service.yaml" >}} 1. Launch a terminal window in the directory you downloaded the manifest files. -1. Create a `Service` to track all Cassandra StatefulSet Nodes from the `cassandra-service.yaml` file: +1. Create a `Service` to track all Cassandra `StatefulSet` nodes from the `cassandra-service.yaml` file: ```shell kubectl create -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml @@ -98,16 +98,16 @@ Service creation failed if anything else is returned. Read [Debug Services](/doc ## Using a StatefulSet to Create a Cassandra Ring -The StatefulSet manifest, included below, creates a Cassandra ring that consists of three Pods. +The `StatefulSet` manifest, included below, creates a Cassandra ring that consists of three `Pod`s. {{< note >}} -**Note:** This example uses the default provisioner for Minikube. Please update the following StatefulSet for the cloud you are working with. +**Note:** This example uses the default provisioner for Minikube. Please update the following `StatefulSet` for the cloud you are working with. {{< /note >}} {{< codenew file="application/cassandra/cassandra-statefulset.yaml" >}} -1. Update the StatefulSet if necessary. -1. Create the Cassandra StatefulSet from the `cassandra-statefulset.yaml` file: +1. Update the `StatefulSet` if necessary. +1. Create the Cassandra `StatefulSet` from the `cassandra-statefulset.yaml` file: ```shell kubectl create -f https://k8s.io/examples/application/cassandra/cassandra-statefulset.yaml @@ -115,7 +115,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists ## Validating The Cassandra StatefulSet -1. Get the Cassandra StatefulSet: +1. Get the Cassandra `StatefulSet`: ```shell kubectl get statefulset cassandra @@ -128,9 +128,9 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists cassandra 3 0 13s ``` - The StatefulSet resource deploys Pods sequentially. + The `StatefulSet` resource deploys `Pod`s sequentially. -1. Get the Pods to see the ordered creation status: +1. Get the `Pod`s to see the ordered creation status: ```shell kubectl get pods -l="app=cassandra" @@ -144,7 +144,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists cassandra-1 0/1 ContainerCreating 0 8s ``` - Please note that it may take several minutes for all three Pods to deploy. Once they are deployed, the same command returns: + Please note that it may take several minutes for all three `Pod`s to deploy. Once they are deployed, the same command returns: ``` NAME READY STATUS RESTARTS AGE @@ -174,7 +174,7 @@ The StatefulSet manifest, included below, creates a Cassandra ring that consists ## Modifying the Cassandra StatefulSet -Use `kubectl edit` to modify the size of a Cassandra StatefulSet. +Use `kubectl edit` to modify the size of a Cassandra `StatefulSet`. 1. Run the following command: @@ -182,7 +182,7 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. kubectl edit statefulset cassandra ``` - This command opens an editor in your terminal. The line you need to change is the `replicas` field. The following sample is an excerpt of the StatefulSet file: + This command opens an editor in your terminal. The line you need to change is the `replicas` field. The following sample is an excerpt of the `StatefulSet` file: ```yaml # Please edit the object below. Lines beginning with a '#' will be ignored, @@ -207,9 +207,9 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. 2. Change the number of replicas to 4, and then save the manifest. - The StatefulSet now contains 4 Pods. + The `StatefulSet` now contains 4 `Pod`s. -1. Get the Cassandra StatefulSet to verify: +1. Get the Cassandra `StatefulSet` to verify: ```shell kubectl get statefulset cassandra @@ -225,13 +225,13 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet. {{% /capture %}} {{% capture cleanup %}} -Deleting or scaling a StatefulSet down does not delete the volumes associated with the StatefulSet. This ensures safety first: your data is more valuable than an auto purge of all related StatefulSet resources. +Deleting or scaling a `StatefulSet` down does not delete the volumes associated with the `StatefulSet`. This ensures safety first: your data is more valuable than an auto purge of all related StatefulSet resources. {{< warning >}} -**Warning:** Depending on the storage class and reclaim policy, deleting the PersistentVolumeClaims may cause the associated volumes to also be deleted. Never assume you’ll be able to access data if its volume claims are deleted. +**Warning:** Depending on the storage class and reclaim policy, deleting the `PersistentVolumeClaim`s may cause the associated volumes to also be deleted. Never assume you’ll be able to access data if its volume claims are deleted. {{< /warning >}} -1. Run the following commands (chained together into a single command) to delete everything in the Cassandra StatefulSet: +1. Run the following commands (chained together into a single command) to delete everything in the Cassandra `StatefulSet`: ```shell grace=$(kubectl get po cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \ @@ -251,8 +251,8 @@ Deleting or scaling a StatefulSet down does not delete the volumes associated wi {{% capture whatsnext %}} -* Learn how to [Scale a StatefulSet](/docs/tasks/run-application/scale-stateful-set/). -* Learn more about the [KubernetesSeedProvider](https://github.com/kubernetes/examples/blob/master/cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java) +* Learn how to [Scale a `StatefulSet`](/docs/tasks/run-application/scale-stateful-set/). +* Learn more about the [`KubernetesSeedProvider`](https://github.com/kubernetes/examples/blob/master/cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java) * See more custom [Seed Provider Configurations](https://git.k8s.io/examples/cassandra/java/README.md) {{% /capture %}}