diff --git a/deploy/local-storage/persistent-volume-0.yaml b/deploy/local-storage/persistent-volume-0.yaml new file mode 100644 index 0000000..1ae6670 --- /dev/null +++ b/deploy/local-storage/persistent-volume-0.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: podinfo-vol-0 + annotations: + "volume.alpha.kubernetes.io/node-affinity": '{ + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [ + { "matchExpressions": [ + { "key": "kubernetes.io/hostname", + "operator": "In", + "values": ["kube-node-0"] + } + ]} + ]}}' +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-ssd + local: + path: /mnt/data diff --git a/deploy/local-storage/persistent-volume-1.yaml b/deploy/local-storage/persistent-volume-1.yaml new file mode 100644 index 0000000..8c253f1 --- /dev/null +++ b/deploy/local-storage/persistent-volume-1.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: podinfo-vol-1 + annotations: + "volume.alpha.kubernetes.io/node-affinity": '{ + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [ + { "matchExpressions": [ + { "key": "kubernetes.io/hostname", + "operator": "In", + "values": ["kube-node-1"] + } + ]} + ]}}' +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-ssd + local: + path: /mnt/data diff --git a/deploy/local-storage/service.yaml b/deploy/local-storage/service.yaml new file mode 100644 index 0000000..bfec26a --- /dev/null +++ b/deploy/local-storage/service.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: podinfo +spec: + clusterIP: None + publishNotReadyAddresses: false + ports: + - port: 9898 + targetPort: 9898 + selector: + app: podinfo diff --git a/deploy/local-storage/statefulset.yaml b/deploy/local-storage/statefulset.yaml new file mode 100644 index 0000000..1c64e03 --- /dev/null +++ b/deploy/local-storage/statefulset.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: apps/v1beta2 +kind: StatefulSet +metadata: + name: podinfo +spec: + serviceName: "podinfo" + replicas: 2 + podManagementPolicy: OrderedReady + selector: + matchLabels: + app: podinfo + template: + metadata: + labels: + app: podinfo + annotations: + prometheus.io/scrape: "true" + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: role + operator: In + values: + - local-ssd + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - podinfo + topologyKey: "kubernetes.io/hostname" + containers: + - name: probe + image: stefanprodan/podinfo:0.0.7 + command: + - ./podinfo + - -port=9898 + - -logtostderr=true + - -v=2 + ports: + - name: http + containerPort: 9898 + protocol: TCP + livenessProbe: + httpGet: + path: /healthz + port: 9898 + readinessProbe: + httpGet: + path: /readyz + port: 9898 + volumeMounts: + - name: data + mountPath: /data + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 16Mi + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: local-ssd + resources: + requests: + storage: 1Gi diff --git a/deploy/local-storage/storage-class.yaml b/deploy/local-storage/storage-class.yaml new file mode 100644 index 0000000..adc7331 --- /dev/null +++ b/deploy/local-storage/storage-class.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-ssd +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer