Created
September 12, 2021 05:45
-
-
Save a-patel/6d50c632637d571106fcb91d732586e5 to your computer and use it in GitHub Desktop.
Kubernetes - StatefulSet with Volume
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
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: myapp-mongodb-sts | |
namespace: myapp-ns | |
labels: | |
app: myapp-mongodb | |
spec: | |
serviceName: mongodb | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: mongodb | |
template: | |
metadata: | |
labels: | |
app: mongodb | |
spec: | |
containers: | |
- name: myapp-mongodb | |
image: mongo | |
imagePullPolicy: IfNotPresent | |
ports: | |
- name: mongodb | |
containerPort: 27017 | |
volumeMounts: | |
- name: myapp-mongo-volume | |
mountPath: /var/lib/mongodb | |
# Mongo Secret code is ommited due to brevity. | |
volumes: | |
- name: myapp-mongo-volume | |
persistentVolumeClaim: | |
claimName: myapp-mongo-pvc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment