Installing Vertica on a Single-Node Kubernetes Cluster Using Minikube

dm8ry

Dmitry Romanoff

Posted on October 19, 2024

Installing Vertica on a Single-Node Kubernetes Cluster Using Minikube

Setting up Vertica, a powerful analytic database, on a single-node Kubernetes cluster can streamline your data analytics projects. In this guide, we’ll walk through the process of installing Vertica using Minikube, covering all the necessary steps from prerequisites to verification.

Prerequisites

Before we begin, ensure you have the following software installed on your machine:

  • Minikube: Download from the official Minikube site.
  • kubectl: The command-line tool for interacting with Kubernetes clusters. Installation instructions can be found here.
  • Docker: Ensure Docker is running, as Minikube uses Docker for container management.

Steps to Install Vertica

1. Start Minikube

First, we’ll start Minikube with allocated resources:

minikube start --memory=4096 --cpus=2
Enter fullscreen mode Exit fullscreen mode

2. Create a Namespace for Vertica

Namespaces help organize resources within a Kubernetes cluster. Let’s create a namespace specifically for Vertica:

kubectl create namespace vertica
Enter fullscreen mode Exit fullscreen mode

3. Create a Persistent Volume (PV)

To store Vertica data, we need a Persistent Volume. Create a file named vertica-pv.yaml with the following content:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: vertica-pv
  namespace: vertica
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /mnt/data
Enter fullscreen mode Exit fullscreen mode

Now, apply the configuration:

kubectl apply -f vertica-pv.yaml
Enter fullscreen mode Exit fullscreen mode

4. Create a Persistent Volume Claim (PVC)

Next, we’ll create a Persistent Volume Claim to request storage resources. Create a file named vertica-pvc.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: vertica-pvc
  namespace: vertica
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
Enter fullscreen mode Exit fullscreen mode

Apply the PVC configuration:

kubectl apply -f vertica-pvc.yaml
Enter fullscreen mode Exit fullscreen mode

5. Deploy Vertica

Now, we’ll create a deployment for Vertica. Create a file named vertica-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: vertica
  namespace: vertica
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vertica
  template:
    metadata:
      labels:
        app: vertica
    spec:
      containers:
      - name: vertica
        image: vertica/vertica-ce
        ports:
        - containerPort: 5433
        volumeMounts:
        - name: vertica-storage
          mountPath: /data
      volumes:
      - name: vertica-storage
        persistentVolumeClaim:
          claimName: vertica-pvc
Enter fullscreen mode Exit fullscreen mode

Apply the deployment:

kubectl apply -f vertica-deployment.yaml
Enter fullscreen mode Exit fullscreen mode

6. Expose Vertica Service

To access Vertica, we need to create a service. Create a file named vertica-service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: vertica-service
  namespace: vertica
spec:
  type: NodePort
  ports:
  - port: 5433
    targetPort: 5433
    nodePort: 30000
  selector:
    app: vertica
Enter fullscreen mode Exit fullscreen mode

Apply the service configuration:

kubectl apply -f vertica-service.yaml
Enter fullscreen mode Exit fullscreen mode

7. Access Vertica

You can now access Vertica using a database client. First, find the Minikube IP:

minikube ip
Enter fullscreen mode Exit fullscreen mode

Use this IP and the node port (30000) to connect via your preferred database client.

Verification

To check if everything is running smoothly, execute the following commands:

kubectl get pods -n vertica
kubectl get svc -n vertica
Enter fullscreen mode Exit fullscreen mode

To connect to the Vertica database using the vsql client utility, run:

vsql -h <minikube-ip> -p 30000 -U dbadmin
Enter fullscreen mode Exit fullscreen mode

You should see a welcome message, confirming that you are connected.
Cleanup

Once you’ve finished testing, you can delete the resources you created:

kubectl delete namespace vertica
Enter fullscreen mode Exit fullscreen mode

Conclusion

You’ve successfully installed Vertica on a single-node Kubernetes cluster using Minikube! This setup provides a solid foundation for data analytics projects. Depending on your requirements, consider configuring additional parameters like resource limits, readiness/liveness probes, and backups. For advanced configurations and best practices, always refer to the official Vertica documentation.

💖 💪 🙅 🚩
dm8ry
Dmitry Romanoff

Posted on October 19, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related