Kubernetes
Helm Setup
YugaByte DB
Tech Tutorials
Cloud Computing

How do I perform the k8s/helm setup of YB?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Deploying a YugabyteDB (YB) cluster using Helm in Kubernetes (K8s) offers a robust solution for managing distributed databases on cloud-native infrastructure. This detailed guide will provide step-by-step instructions and key considerations for setting up YugabyteDB using Helm.

Prerequisites

Before getting started, you should have the following components installed and configured:

  • Kubernetes Cluster: Ensure you have administrative access to a Kubernetes cluster (version 1.17 or higher recommended). If you don’t have one, you can create a cluster on cloud providers like Google Cloud, AWS, or use local solutions like minikube or kind.
  • Helm 3: Helm is a package manager for Kubernetes that simplifies the deployment and management of applications. Install the latest version of Helm 3 from the official Helm releases page.

Step 1: Add the Helm Chart Repository

To start, you need to add the Helm Chart repository that contains YugabyteDB charts. Execute the following command to add the repository:

bash
helm repo add yugabyte https://charts.yugabyte.com
helm repo update

Step 2: Configure the Helm Chart

Before installing the chart, you can customize the configuration parameters according to your specific needs. You can modify the default settings by editing the values.yaml file of the YugabyteDB chart. For example, you can adjust the resource requests/limits, replica counts, etc.

Fetch the default values.yaml with this command:

bash
helm show values yugabyte/yugabyte > yugabyte-values.yaml

Open yugabyte-values.yaml in an editor and modify the parameters.

Step 3: Install YugabyteDB

With the configuration tailored to your environment, you can now install the YugabyteDB chart using the helm install command:

bash
helm install my-yb-cluster yugabyte/yugabyte --version 2.9.1 --values yugabyte-values.yaml --namespace yb-db --create-namespace

This command installs YugabyteDB in the yb-db namespace (the namespace is created if it doesn’t exist). Replace my-yb-cluster with your preferred release name.

Step 4: Verify the Installation

After the installation, check the status of your YugabyteDB pods by running:

bash
kubectl get pods -n yb-db

Ensure that all pods are in the RUNNING state. You can also check the services created by Helm for YugabyteDB:

bash
kubectl get svc -n yb-db

Step 5: Accessing YugabyteDB

To interact with your YugabyteDB cluster, you can use kubectl to forward a port to the YugabyteDB master leader:

bash
kubectl port-forward svc/my-yb-cluster-yb-master-ui 7000:7000 -n yb-db

Then, you can access the YugabyteDB Admin UI by navigating to http://localhost:7000.

Maintaining and Upgrading

Upgrading: To upgrade your YugabyteDB deployment to a newer version, use the helm upgrade command with the new chart version.

bash
helm upgrade my-yb-cluster yugabyte/yugabyte --version new_version --reuse-values -n yb-db

Scaling: To scale your cluster, you can adjust the replicas count in the values.yaml and apply changes:

bash
helm upgrade my-yb-cluster yugabyte/yugabyte --values yugabyte-values.yaml -n yb-db

Backup and Recovery: Regularly back up your YugabyteDB data by leveraging YugabyteDB’s built-in distributed backup capabilities.

Summary Table

Here’s a quick recap of the main steps:

StepActionCommand / URL
1Add Helm Repohelm repo add yugabyte https://charts.yugabyte.com
2Edit ConfigurationEdit yugabyte-values.yaml
3Install YugabyteDBhelm install my-yb-cluster yugabyte/yugabyte ...
4Check Pods and Serviceskubectl get pods/svc -n yb-db
5Access YugabyteDBhttp://localhost:7000 after port-forward

Conclusion

Deploying YugabyteDB on Kubernetes using Helm not only simplifies the setup process but also provides scalability, resilience, and manageability. It’s ideal for users seeking to leverage Kubernetes for distributed database systems.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.