Last active
May 18, 2019 15:12
-
-
Save arcnavier/26944f64ba0342c3eb47ee79bd08c5d7 to your computer and use it in GitHub Desktop.
This file contains 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
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nodejs-demo | |
spec: | |
ports: | |
- name: nodejs-web | |
port: 8080 | |
type: NodePort | |
selector: | |
app: nodejs-demo | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: nodejs-demo-pv-claim | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 32Mi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nodejs-demo | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: nodejs-demo | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: nodejs-demo | |
spec: | |
containers: | |
- image: node:10 | |
name: node10 | |
env: | |
- name: VOLUME_MOUNT | |
value: /data | |
volumeMounts: | |
- name: demo-data | |
mountPath: /data | |
ports: | |
- name: demo-port | |
containerPort: 8080 | |
command: | |
- /bin/bash | |
- "-c" | |
- "date >> /data/log.txt" | |
volumes: | |
- name: demo-data | |
persistentVolumeClaim: | |
claimName: nodejs-demo-pv-claim | |
--- | |
kind: PersistentVolume | |
apiVersion: v1 | |
metadata: | |
name: demo-pv-volume | |
spec: | |
capacity: | |
storage: 128Mi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: "/mnt/data" |
This file contains 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
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nodejs-demo-statefulset | |
spec: | |
ports: | |
- name: nodejs-web | |
port: 8080 | |
type: NodePort | |
selector: | |
app: nodejs-demo-statefulset | |
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: nodejs-demo-statefulset | |
spec: | |
replicas: 3 | |
serviceName: nodejs-demo-statefulset | |
selector: | |
matchLabels: | |
app: nodejs-demo-statefulset | |
template: | |
metadata: | |
labels: | |
app: nodejs-demo-statefulset | |
spec: | |
containers: | |
- image: node:10 | |
name: node10 | |
env: | |
- name: DATA_VOLUME | |
value: /data | |
volumeMounts: | |
- name: demo-data | |
mountPath: /data | |
ports: | |
- name: demo-port | |
containerPort: 8080 | |
command: | |
- /bin/bash | |
- "-c" | |
- "date >> /data/log.txt; sleep 86400" | |
volumeClaimTemplates: | |
- metadata: | |
name: demo-data | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 32Mi |
This file contains 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
--- | |
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: local | |
provisioner: kubernetes.io/no-provisioner | |
volumeBindingMode: WaitForFirstConsumer | |
--- | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: local-pv | |
spec: | |
capacity: | |
storage: 1Gi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: /mnt/data | |
--- | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: local-pv2 | |
spec: | |
capacity: | |
storage: 1Gi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: /mnt/data2 | |
--- | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: local-pv3 | |
spec: | |
capacity: | |
storage: 1Gi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: /mnt/data3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment