Skip to content

smileee/statefulset-k8s-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

statefulset-k8s-example

k8s stateful set

Deploy SSD disk on K8s

kubectl apply -f google_cloud-ssd.yaml
storageclass.storage.k8s.io/fast-disk created

Deploy mongo statefulset

kubectl apply -f mongo-statefulset.yaml

kubectl get pods

To scale statefulset:

kubectl scale --replicas=4 statefulset mongo

Delete mongodb services

Use kubectl delete to delete the services

kubectl delete statefulset mongo

kubectl delete svc mongo

kubectl delete pvc -l role=mongo

References

  1. https://github.com/cvallance/mongo-k8s-sidecar
  2. Running a MongoDB Database in Kubernetes with StatefulSets

Troubleshoot

$ 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

About

Deploy Mongo Stateful set on kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors