kubectl apply -f google_cloud-ssd.yaml
storageclass.storage.k8s.io/fast-disk created
kubectl apply -f mongo-statefulset.yaml
kubectl get pods
To scale statefulset
:
kubectl scale --replicas=4 statefulset mongo
Use kubectl delete
to delete the services
kubectl delete statefulset mongo
kubectl delete svc mongo
kubectl delete pvc -l role=mongo
- https://github.com/cvallance/mongo-k8s-sidecar
- Running a MongoDB Database in Kubernetes with StatefulSets
$ kubectl apply -f mongo-statefulset.yaml
error: error validating "mongo-statefulset.yaml": error validating data: ValidationError(StatefulSet.spec.volumeClaimTemplates[0]): unknown field "annotations" in io.k8s.api.core.v1.PersistentVolumeClaim; if you choose to ignore these errors, turn validation off with --validate=false
reason: check for the syntax error
$ kubectl apply -f mongo-statefulset.yaml
Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden