Last active
October 3, 2023 05:35
-
-
Save sanskarsharma/f5647a3a082d3fe3f620dcdf9ba7cda0 to your computer and use it in GitHub Desktop.
Example stateful application on kubernetes: my-stateful-app
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: PersistentVolumeClaim | |
metadata: | |
name: my-stateful-app-pvc | |
labels: | |
app: my-stateful-app | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: my-stateful-app | |
labels: | |
app: my-stateful-app | |
spec: | |
replicas: 1 | |
strategy: | |
type: RollingUpdate | |
selector: | |
matchLabels: | |
app: my-stateful-app | |
template: | |
metadata: | |
labels: | |
app: my-stateful-app | |
spec: | |
containers: | |
- name: my-stateful-app | |
image: busybox | |
command: [ "/bin/sh", "-c", "--" ] | |
args: [ 'touch /data/file1.txt; while true; do echo "Hellu"; sleep 2; done;' ] | |
resources: | |
requests: | |
memory: 100Mi | |
limits: | |
memory: 100Mi | |
env: | |
- name: DUMMY | |
value: '1' | |
volumeMounts: | |
- name: my-stateful-app-vol | |
mountPath: /data | |
volumes: | |
- name: my-stateful-app-vol | |
persistentVolumeClaim: | |
claimName: my-stateful-app-pvc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment