Deploy a production Database in Kubernetes

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024

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

  • @vitusyu9583
    @vitusyu9583 7 месяцев назад

    Thanks for your concise and informative illustration. It is so enlightening for me as a Kubernetes beginner!

    • @sre101
      @sre101  7 месяцев назад

      Thanks a lot for your kind words :)

  • @cloudpillsdaily
    @cloudpillsdaily 7 месяцев назад +1

    loved this video!! subbed right away!!

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

      thank you!

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

    Excellent Video...Please keep doing the good work. 👍👍

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

      Glad you found it useful :)

  • @pankajtripathi2072
    @pankajtripathi2072 7 месяцев назад

    great content and video 👍

    • @sre101
      @sre101  7 месяцев назад

      Thank you Pankaj, means a lot

  • @samsulhaque8064
    @samsulhaque8064 13 дней назад

    nice explanation,, lets say i have 5 worker node and my writer pod scheduled at worker 3 with persistence volume dynamically ,, if that worker node goes down what will happen ..

    • @hamzaerrahma9858
      @hamzaerrahma9858 4 дня назад

      Hi brother, did you implement that? Are the pods running successfully without restarts?

  • @PushpenduPaul-k3l
    @PushpenduPaul-k3l Год назад +1

    Hi, I didn't get how replica set gets only pod's IP instead of service IP. Could you please explain in detail?

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

      We Create a Headless service ( by setting clusterIP: None). This assigns all the pods a unique DNS name instead of just a cluster-level IP.
      The mysql-0 dns name is always the writer because we write this logic in the statefultsets configuration file (if index == 0, apply master config else apply reader config)
      kubernetes.io/docs/concepts/services-networking/service/#headless-services

  • @maheshkumarnaik754
    @maheshkumarnaik754 3 месяца назад

    could you provide me the code for statefull set

    • @sre101
      @sre101  3 месяца назад

      github.com/duaraghav8/SRE101/blob/main/run-db-in-k8s/statefulsets.yaml

  • @Kk-rl7nv
    @Kk-rl7nv 7 месяцев назад

    @sre101: can you suggest storage class which used and also suggest if you increase replica then seperate Pv will be provisioned as per value defined in pvc, and also suggest how we can do in AWS if we want to keep seperate Pv for each project then how

    • @sre101
      @sre101  7 месяцев назад

      Storage class really depends on the nature of your data and what matters more to you.
      eg- If you're storing payment transactions data, you want very strong guarantees that this data will not be lost, even if the latency is a bit high.
      You want backups and disaster recovery on it.
      You probably also want the database to be CP (in terms of CAP theorem).
      So your storage class would reflect those needs.

    • @Kk-rl7nv
      @Kk-rl7nv 7 месяцев назад

      @@sre101: can you please create a video or suggest as per my queries: 1: which storage class you used?, 2:if we want 3 replicas, then we would need to create pvc definition for each members in yaml files.?
      3: how we can do in AWS if we want to keep seperate PV for each project?

    • @sre101
      @sre101  7 месяцев назад +1

      @@Kk-rl7nv
      1. Because I'm using minikube, I'm using the csi-hostpath-driver (see minikube.sigs.k8s.io/docs/tutorials/volume_snapshots_and_csi/)
      2. No, that's not scalable. Instead, you can use VolumeClaimTemplate (github.com/duaraghav8/SRE101/blob/main/run-db-in-k8s/statefulsets.yaml#L157)
      3. I believe you would need an appropriate Volume plugin to use AWS storage. Maybe this article can help you - aws.amazon.com/blogs/storage/persistent-storage-for-kubernetes/

  • @vishalpoudel6712
    @vishalpoudel6712 7 месяцев назад

    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?

    • @sre101
      @sre101  7 месяцев назад

      Depends on the nature of your data.
      Normally, people want high durability guarantees for their production data. So storing them on local machine disks is not a great strategy.
      So for example, your Persistent Volume could connect to AWS EBS or S# under the hood and whenever your app writes some data to this PV, it is actually being written to the AWS storage.
      If you want to store structured data in AWS RDS, you don't need a PV. In that case you application directly connects to the RDS database using its endpoint and credentials.

  • @atiqbepari7155
    @atiqbepari7155 10 дней назад

    i need to have high availability and auto failover for master.
    What needs to be done here?

    • @hamzaerrahma9858
      @hamzaerrahma9858 4 дня назад

      Hi brother, did you implement that? Are the pods running successfully without restarts?

    • @sre101
      @sre101  2 дня назад

      for HA - deploy more read replica pods across different worker nodes (or even different datacenters, regions)
      for HA for writer, you'll need to explore sharding.
      I haven't implemented auto failover myself yet, so can't comment much about it.

  • @girupashankari4375
    @girupashankari4375 25 дней назад

    Good learnings, thanks for the wonderful video 😊

    • @sre101
      @sre101  24 дня назад

      🙌

    • @hamzaerrahma9858
      @hamzaerrahma9858 4 дня назад

      Hi brother, did you implement that? Are the pods running successfully without restarts?

    • @sre101
      @sre101  2 дня назад

      @@hamzaerrahma9858 I ran it in production for a few weeks but for personal use. There were no restarts unless mysql itself crashed (mostly due to resource constraints for me)

  • @TamilselviMano-d7r
    @TamilselviMano-d7r 7 месяцев назад +1

    Thanks @Raghav for a clear explanation. Would like see more videos on DB scaling dynamically in K8s.

    • @sre101
      @sre101  7 месяцев назад

      Hey Thanks for the feedback! I agree, I'm planning a part 2 for this where I cover more advanced topics like autoscaling, backups & disaster recovery, performance tuning, etc.

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

    How can i do this with an NFS server instead of stroring data locally

  • @NavneetArakony
    @NavneetArakony 5 месяцев назад

    Thank you for the very useful video! Can you explain how the writer pod can be scaled if at all?

    • @sre101
      @sre101  5 месяцев назад

      Great question. The writer Pod's scaling mainly depends on how you scale the writer node of MySQL.
      IMO you have 2 options:
      1. Vertical scaling: Keep adding more CPU, Memory, Disk, Network bandwidth resources to your writer machine until you reach the most expensive machine and any further addition only degrades the performance.
      With vertical, you still don't have high availability in writer.
      2. Horizontal scaling: Add more writer nodes and distribute the write queries among them. This can be accomplished using Sharding.
      Some tricks you can also use:
      1. people use to scale writer is to direct all read queries to read replicas so that the writer only needs to deal with write requests, so it can give higher throughput.
      2. Use faster storage disk to increase data write speed. this can increase throughput.

  • @얀고양이-f9h
    @얀고양이-f9h 6 месяцев назад

    In the video, the headless Service "mysql" is bound to the StatefulSet "mysql". This StatefulSet is also bound to the Service "mysql-read"? I mean the "serviceName" in the StatefulSet is set to "mysql" which is the headless service, not "mysql-read".

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

      The StatefulSet is bount to the "mysql" service because that;s the main service controlling the cluster.