How to run MongoDB with StatefulSet in Kubernetes?

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024
  • In this video, I'll show you how to run MongoDB in Kubernetes using a StatefulSet.
    #kubernetes #kubernetescourse
    If you like the video, consider subscribing: / peterjausovec
    ▬▬▬▬▬▬ Connect with me ▬▬▬▬▬▬
    ➡️ Newsletter: learncloudnati...
    ➡️ Twitter: / pjausovec
    ➡️ LinkedIn: / pjausovec

Комментарии • 29

  • @georgeradu3759
    @georgeradu3759 Год назад +11

    How about data sync between db pods ?

  • @RMHashan
    @RMHashan 2 года назад +4

    Nice and clear explanation. Thanks Peter!

  • @tukuhlimbumcartooncomedy5063
    @tukuhlimbumcartooncomedy5063 Год назад

    Best statefulSet video I've seen so far

  • @黃大煒-j4i
    @黃大煒-j4i 5 месяцев назад

    Overall great video, 1 reminder is that the ip addr of a pod may has changed once it gets restarted.

    • @learncloudnative
      @learncloudnative  5 месяцев назад +2

      The idea behind StatefulSets is that each pod get's a unique index and a stable identity (but yes, IPs will be different in case of a restart and one should never rely on pod IPs in any case).

  • @davidbaldonado855
    @davidbaldonado855 Год назад

    I manage to make it work! Thank you so much! I'm using AWS to host my kubernetes, all works well but I can't seem to connect to the replica set using mongodb compass.

  • @vishalpoudel6712
    @vishalpoudel6712 8 месяцев назад +1

    do we store the data of database pods in another instance outside of the cluster like aws rds or we just store everything in those storage classes itself in production?

    • @learncloudnative
      @learncloudnative  8 месяцев назад

      you’d use a persistent volume and a persistent volume claim to “claim” some storage for pods. the storage itself is outside of the cluster - you can define volumes in aws or azure, gcp…

  • @Kk-rl7nv
    @Kk-rl7nv 8 месяцев назад +1

    Hi Learncloudnative
    Can you suggest for storage section which storage you used I.e local or any cloud, I was searching for the cloud template for AWS

    • @learncloudnative
      @learncloudnative  8 месяцев назад

      hi! here are the YAML files I used for these videos: github.com/peterj/k8s-shorts-files/tree/main/files

  • @Rohit-kx6ps
    @Rohit-kx6ps Месяц назад

    how can i connect with mongo compass?

  • @indianajones7197
    @indianajones7197 Год назад

    Hello. I have a issue with the pod . always pending and pv,pvc didn't automatic create. need enable some feature or other yaml file to create? Thanks. K9s official document statefulset nginx same like this its pod also pending and waiting for pv/pvc resource. so I need to create pv/pvc by manual first? Thanks!

    • @learncloudnative
      @learncloudnative  Год назад

      What are the errors you're seeing? You will have to create a PersistentVolume resource first, and that would depend on where you're running your cluster. Check out this video where I talk about PVs and PVCs

  • @graficospace5235
    @graficospace5235 Год назад

    I can't connect with mongo atlas, I have to expose the service externally, so it becomes the link to connect..I connected from k8s but externally it's impossible from Gke..why?

    • @learncloudnative
      @learncloudnative  Год назад +1

      Hi! You'll have to expose the k8s service externally to connect to it, otherwise it's not going to work.

  • @GebzNotJebz
    @GebzNotJebz 10 месяцев назад +3

    Unfortunately not very useful since each pod has its own storage so the data is independent in each pod, defeating the purpose of having it on k8s.

  • @guptaashwanee
    @guptaashwanee Год назад +1

    But in this case, mongodb is not running as replica sets, there are 3 different mongo instances,

    • @learncloudnative
      @learncloudnative  Год назад

      The idea here was to show how StatefulSets allow you to manage stateful applications - i.e. guaranteeing the uniqueness of the pods - hence the different instances with different set of data.

  • @r.avinashkumar5372
    @r.avinashkumar5372 Год назад

    what is the use of these replica set the data is not replicated among the dbs

    • @learncloudnative
      @learncloudnative  Год назад +1

      ReplicaSet is a Kubernetes concept and it doesn't have anything to do with DB or data in this case. Even if you're not using StatefulSets, the ReplicaSet in K8s ensures there's always a specified number of pods running in the cluster.

    • @GebzNotJebz
      @GebzNotJebz 10 месяцев назад

      you miss the point of having the database on the kubernetes, what is the use of having 3 instances of mongo if you don't have the same data on all three? you just created 3 different mongodb instances. @@learncloudnative

  • @roopesh668
    @roopesh668 Год назад

    Why kubernetes created 3 pods instead of 1?

    • @learncloudnative
      @learncloudnative  Год назад

      initially, it created only one, but then we used the "scale" command to create 3 replicas

  • @omerpriel5588
    @omerpriel5588 4 месяца назад

    why mongo 4.0.17 and not 7.0 ?

    • @learncloudnative
      @learncloudnative  4 месяца назад

      the video was recorded a long time ago :) shouldn’t be any different if you updated to 7.0

  • @Jalaveyan
    @Jalaveyan 6 месяцев назад

    so thanks bro! y my god