Skip to content

Commit 9b721db

Browse files
authored
feat(statefulset): improve the readme (#31)
1 parent 207b07d commit 9b721db

File tree

2 files changed

+13
-46
lines changed

2 files changed

+13
-46
lines changed

18-stateful-set/README.md

+13-46
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,8 @@
1-
# Other topics
1+
# Stateful Sets
22

33
## Introduction
44

5-
In this section you will get an overview of others Kubernetes useful features, in order of complexity.
6-
7-
## Namespace
8-
9-
`Namespaces` is the way to support multiple virtual clusters in Kubernetes.
10-
11-
They are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about `namespaces` at all. Start using `namespaces` when you need the features they provide.
12-
13-
By default, all objects are in the `default` namespace. There is a "hidden" `namespace` where Kubernetes runs services for itself.
14-
Try:
15-
16-
```sh
17-
$ kubectl get namespace
18-
NAME STATUS AGE
19-
default Active 56d
20-
kube-public Active 56d
21-
kube-system Active 56d
22-
```
23-
24-
```sh
25-
$ kubectl get all --namespace=kube-system
26-
27-
[lot of stuff]
28-
```
29-
30-
## `kubeval`
31-
32-
It is a tool to validate your Kubernetes YAML files: <https://github.com/garethr/kubeval>
33-
34-
The easiest integration is with `docker run`, if you files are in the directory `kubernetes`
35-
36-
```sh
37-
docker run -it -v `pwd`/kubernetes:/kubernetes garethr/kubeval kubernetes/**/*
38-
```
39-
40-
## Helm
41-
42-
It is a package manager for Kubernetes: <https://helm.sh/>.
43-
It contains multiple, ready to use, Kubernetes manifest for projects, for example [mysql](https://github.com/helm/charts/tree/master/stable/mysql)
44-
45-
## Stateful Set
46-
47-
Like a `Deployment`, a `StatefulSet` manages Pods that are based on an identical container spec. Unlike a `Deployment`, a `StatefulSet` maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
5+
Like a `Deployment`, a `StatefulSet` manages Pods that are based on an identical container spec. Unlike a `Deployment`, a `StatefulSet` maintains a sticky identity for each the pods. These are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
486

497
`StatefulSets` are valuable for applications that require one or more of the following.
508

@@ -88,10 +46,19 @@ spec:
8846
storage: 1Gi
8947
```
9048
49+
As you can see the manifest is very close to the one of a deployment. Apply the manigest [01-statefulset.yml](./01-statefulset.yml).
50+
51+
Look at the pods generated, see how they are generated. Connect to one of the pods:
52+
53+
```sh
54+
kubectl exec -ti web-0 /bin/bash
55+
```
56+
57+
Write a file in the volume `www`. Terminate the same pod. See what happens. Reconnect to the pod, look at volume `www`. What can you see?
58+
9159
## Exercises
9260

93-
1. Install `helm`, and use it to install [`redis`](https://github.com/helm/charts/tree/master/stable/redis) in your minikube
94-
2. Configure a stateful set for nginx with a HPA at 1% CPU, in a namespace `staging`
61+
Nothing to see here.
9562

9663
## Clean up
9764

0 commit comments

Comments
 (0)