How to Deploy Nebula Graph on Kubernetes
How to Deploy Nebula Graph on Kubernetes
In this article, take a look at a tutorial on how to deploy Nebula Graph on Kubernetes.
Join the DZone community and get the full member experience.Join For Free
What Is Kubernetes
Kubernetes (commonly stylized as k8s) is an open-source container-orchestration system, aiming to provide a simple yet efficient platform for automating deployment, scaling, and operations of application containers across clusters of hosts.
Kubernetes has a series of components architecturally, enabling a mechanism that can provide deployment, maintenance, and extension of applications.
The components are designed to be loosely coupled and scalable so that they can meet various kinds of workloads.
The scalability of the system is largely provided by the Kubernetes API which is used mainly as a scalable internal component and as a container running on Kubernetes.
Kubernetes consists mainly of the following core components:
etcdis used as Kubernetes’ backing store for all cluster data
apiserverprovides a unique entry for resource operations and provides mechanisms for authentication, authorization, access control, API registration, and discovery
controller manageris responsible for maintaining the state of the cluster, such as fault detection, automatic expansion, rolling updates, etc.
scheduleris responsible for scheduling resources, and scheduling Pods to corresponding machines according to a predetermined scheduling policy
kubeletis responsible for maintaining the life cycle of the container, and is also responsible for the management of Volume and Network
Container runtimeis responsible for image management and the runtime of the Pod and container (CRI)
kube-proxyis responsible for providing service discovery and load balancing within the cluster for the kubernetes-service
In addition to the core components, there are some recommended Add-ons:
kube-dnsis responsible for providing DNS services for the entire cluster
Ingress Controllerprovides external network access for services
Heapsterprovides resource monitoring
Federationprovides clusters management across Availability Zones
Fluentd-elasticsearchprovides cluster log collection, storage and query
Kubernetes and Databases
Database containerization is a hot topic recently, and what benefits can Kubernetes bring to databases?
- Fault recovery: Kubernetes restarts database applications when that fail, or migrates database to other health nodes in the cluster
- Storage management: Kubernetes provides various solutions on storage management so that databases can adopt different storage systems transparently
- Load balancing: Kubernetes Service provides load-balance by distributing external network traffic evenly to different database replications
- Horizontal scalability: Kubernetes can scale the replicas based on the resource utilization of the current database cluster, thereby improving resource utilization rate
Currently many databases such as MySQL, MongoDB and TiDB all work fine on Kubernetes.
Nebula Graph on Kubernetes
Nebula Graph is a distributed, open source graph database that is comprised of graphd (the query engine), storaged (data storage) and metad (meta data). Kubernetes brings the following benefits to Nebula Graph:
- Kubernetes adjust the workload between the different replicas of the graphd, metad and storaged. The three can discover each other by the dns service provided by Kubernetes.
- Kubernetes encapsulate the details of the underlying storage by storageclass, pvc and pv, no matter what kind of storage-system such as cloud-disk or local-disk.
- Kubernetes can deploy Nebula Graph cluster within seconds and upgrade cluster automatically without perception.
- Kubernetes supports self-healing. Kubernetes can restart the crashed single replica without operations engineer.
- Kubernetes scales the cluster horizontally based on the cluster utility to improve the nebula performance.
We will show you the details on deploying Nebula Graph with Kubernetes in the following part.
Software and Hardware Requirements
The following list is software and hardware requirements involved in the deployment in this post:
- The operation system is CentOS-7.6.1810 x86_64.
- Virtual machine configuration:
- 4 CPU
- 8G memory
- 50G system disk
- 50G data disk A
- 50G data disk B
- Kubernetes cluster is version v1.16.
- Use local PV as data storage.
Following is the cluster topology:
|Server IP||Nebula Services||Role|
||graphd, metad-0, storaged-0
||graphd, metad-1, storaged-1
||graphd, metad-2, storaged-2
Components to Be Deployed
- Install Helm
- Prepare local disks and install local volume plugin
- Install Nebula Graph cluster
- Install ingress-controller
Helm is the Kubernetes package manager similar to yum on CentOS, or apt-get on Ubuntu. Helm makes deploying clusters more easily with Kubernetes. Since this article does not give a detailed introduction to Helm, read the Helm Getting Started Guide to understand more about Helm.
Download and Install Helm
Installing Helm with the following command in your terminal:
View the Helm Version
You can view Helm version with the command
helm version and the output is like the following:
Prepare Local Disks
Configure each node as follows:
Create Mount Directory
Format Data Disks
Mount Data Disks
Deploy Local Volume Plugin
hostDir: /mnt/fast-disks and
# storageClass: true to
hostDir: /mnt/disks and
storageClass: true respectively, then run:
Deploy Nebula Graph Cluster
Download nebula helm-chart Package
Label Kubernetes Slave Nodes
The following is a list of Kubernetes nodes. We need to set the scheduling labels of the worker nodes. We can label 192.168.0.2, 192.168.0.3, 192.168.0.4 with label
|Server IP||Kubernetes roles||nodeName|
Detailed operations are as follows:
Modify the Default Values for nebula helm chart
Following is the directory list of nebula helm-chart:
We need to adjust the value of MetadHosts in the yaml file
master/kubernetes/values.yaml, and replace the IP list with the IPs of the 3 k8s workers in our environment.
Install Nebula Graph via Helm
Ingress-controller is one of the Add-Ons of Kubernetes. Kubernetes exposes services deployed internally to external users through ingress-controller. Ingress-controller also provides load balancing function, which can distribute external access to different replicas of applications in k8s.
Select a Node to Deploy Ingress-Controller
ingress-nginx.yaml deployment file.
Access Nebula Graph Cluster in Kubernetes
View which node ingress-nginx is located in:
Access Nebula Graph Cluster:
How to deploy Kubernetes cluster?
Please refer to the Official Doc on deployment of high-availability Kubernetes clusters.
You can also refer to Installing Kubernetes with Minikube on how to deploy local Kubernetes cluster with minikube.
How to modify the Nebula Graph cluster parameters?
helm install, you can use
--set to override the default variables in
values.yaml. Please refer to Helm on details.
How to observe nebula cluster status?
You can use the
kubectl get pod | grep nebula command or via the kubernetes dashboard.
How to use other disk types?
Please refer to the Storage Classes doc.
Published at DZone with permission of Jamie Liu . See the original article here.
Opinions expressed by DZone contributors are their own.