Skip to content

Commit

Permalink
examples: update k8s examples
Browse files Browse the repository at this point in the history
* Deprecate replication controller example and explain the reasons.

* Update statefulset controller example uncommenting StatefulSet Kind instead of
PetSet Kind
  • Loading branch information
sgotti committed Sep 1, 2017
1 parent 4d58d1b commit c8df4bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Here you can find some examples on running stolon inside kubernetes
There're two examples. The difference between them is how the keepers pods are deployed (the definitions of the other components is identical):

* Using a [statefulset](statefulset) (called `petset` in k8s 1.4)
* Using [replication controllers](rc) (one per keeper).
* **DEPRECATED** Using [replication controllers](rc) (one per keeper).

## Docker image

Expand Down
2 changes: 2 additions & 0 deletions examples/kubernetes/rc/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Stolon inside kubernetes

**DEPRECATED EXAMPLE**: Please use the [statefulset](../statefulset/README.md) example. Using persistent volumes with replication controller/replica sets won't guarantee at most once pod existence and can lead to data corruption with some persistent volume kind that can end attached in rw mode to more than one node at a time.

This is a simple example that uses replication controller for all stolon components.

Since the keeper requires a persistent data directory we define a replication controller with replicas=1 for each keeper. The keeper id is fixed inside the pod template definition so it won't be generated as a unique id but will have a more meaningful name (`keeper0`, `keeper1` etc...).
Expand Down
18 changes: 9 additions & 9 deletions examples/kubernetes/statefulset/stolon-keeper.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# TODO(sgotti) update this to StatefulSet (PetSet where renamed to StatefulSet) when k8s 1.5 is released
## apiVersion: apps/v1beta1
## kind: StatefulSet
apiVersion: apps/v1alpha1
kind: PetSet
# PetSet was renamed to StatefulSet in k8s 1.5
# apiVersion: apps/v1alpha1
# kind: PetSet
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: stolon-keeper
spec:
Expand Down Expand Up @@ -48,7 +48,7 @@ spec:
value: "stolon"
- name: STKEEPER_PG_SU_PASSWORDFILE
value: "/etc/secrets/stolon/password"
## Uncomment this to enable debug logs
# Uncomment this to enable debug logs
#- name: STKEEPER_DEBUG
# value: "true"
ports:
Expand All @@ -62,13 +62,13 @@ spec:
- name: stolon
secret:
secretName: stolon
## Define your own volumeClaimTemplate. This example uses a dynamic provisioning with a storage class of type "anything" that works also with minikube and will provision volume using the hostPath provider, but this shouldn't be used in production and won't work in multi-node cluster.
## In production you should use your own defined storage-class and configure your persistent volumes (statically or dynamic using a provisioner, see k8s doc).
# Define your own volumeClaimTemplate. This example uses dynamic PV provisioning with a storage class named "standard" (so it will works by default with minikube)
# In production you should use your own defined storage-class and configure your persistent volumes (statically or dynamically using a provisioner, see related k8s doc).
volumeClaimTemplates:
- metadata:
name: data
annotations:
volume.alpha.kubernetes.io/storage-class: anything
volume.alpha.kubernetes.io/storage-class: standard
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
Expand Down

0 comments on commit c8df4bd

Please sign in to comment.