Last active
September 6, 2018 08:41
-
-
Save propella/ba888509001a1e12ffe91227350fff1a to your computer and use it in GitHub Desktop.
Kubernetes persistence demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sticky.yaml | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: sticky | |
labels: | |
app: sticky | |
spec: | |
type: LoadBalancer | |
ports: | |
- name: web | |
port: 3333 | |
targetPort: 80 | |
selector: | |
app: sticky | |
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: sticky | |
spec: | |
serviceName: sticky | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: sticky | |
template: | |
metadata: | |
labels: | |
app: sticky | |
spec: | |
containers: | |
- name: nginx | |
image: k8s.gcr.io/nginx-slim:0.8 | |
ports: | |
- containerPort: 80 | |
name: web | |
volumeMounts: | |
- name: sticky-data # マウントしたいボリュームの名前 | |
mountPath: /usr/share/nginx/html # コンテナからみたストレージの位置 | |
volumeClaimTemplates: | |
- metadata: | |
name: sticky-data # ボリュームの名前 | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: 1Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment