---
title: "Installing MariaDB Enterprise Kubernetes Operator on Ubuntu VM"
publish_date: 2025-09-16
author: "Susmeet Khaire"
tags:
  - name: "Docker"
    url: "/resources/blog/tag/docker.md"
  - name: "Kubernetes"
    url: "/resources/blog/tag/kubernetes-2.md"
  - name: "Ubuntu"
    url: "/resources/blog/tag/ubuntu.md"
---

# Installing MariaDB Enterprise Kubernetes Operator on Ubuntu VM

### Introduction

[MariaDB Enterprise Kubernetes Operator](https://staging-mdb.com/products/enterprise/components/#operator) simplifies the deployment and management of **MariaDB databases** within a Kubernetes environment. This guide walks you through installing the operator on an **Ubuntu VM**, which can be used for testing before implementing in a production environment.

### Overview

Before proceeding, ensure you have: **Ubuntu VM** (20.04 or later)

1. Install **Docker**
2. Install **Kubernetes cluster** (**Minikube** for testing)
3. Install **kubectl** to interact with the cluster
4. Add customer credentials access to docker.mariadb.com
5. Installed **Helm** kubernetes package manager
6. Add **MariaDB Enterprise Operator** to helm repository
7. Install **MariaDB Enterprise Operator**
8. Deploy a MariaDB Instance
9. Verify Deployment
10. Interacting with the instance

### Installation Instructions

1. Install **Docker** to run minikube  
    Official guide: [Ubuntu](https://docs.docker.com/engine/install/ubuntu/)

```
-- Add current user to sudoers (if not already added)su -adduser skhaire sudo-- Run the following command to uninstall all conflicting packages:for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done-- Setup the Docker apt repository.-- Add Docker's official GPG key:sudo apt-get updatesudo apt-get install ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc-- Add the repository to Apt sources:echo \  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \  sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullsudo apt-get update-- Install the latest versionsudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin-- Verify that the installation is successful by running the hello-world image:sudo docker run hello-world
```





2\. Install **minikube** &amp; start minikube  
minikube sets up a local Kubernetes cluster  
Offical guide: [minikube start](https://minikube.sigs.k8s.io/docs/start/)

```
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64minikube start
```

**Note**: In case of ‘permission denied’ error as below,

*skhaire@Ubuntu:~$ minikube start*

- *minikube v1.36.0 on Ubuntu 22.04 (vbox/amd64)*
- *Unable to pick a default driver. Here is what was considered, in preference order:*
    - *docker: Not healthy: “docker version –format {{.Server.Os}}-{{.Server.Version}}:{{.Server.Platform.Name}}” exit status 1: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get “*[*http://%2Fvar%2Frun%2Fdocker.sock/v1.49/version*](https://mariadbcorp.atlassian.net/wiki/spaces/~622a91c215521d00726f0952/pages/3085729797/Installing+MariaDB+Enterprise+Kubernetes+Operator+on+Ubuntu+VM#)*“: dial unix /var/run/docker.sock: connect: permission denied*

Add your user to ‘docker’ group

```
sudo usermod -aG docker $USER && newgrp docker
```

3\. Install **kubectl**  
Official guide: [Install and Set Up kubectl on Linux](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/)

```
sudo apt-get updatesudo apt-get install -y apt-transport-https ca-certificates curl gnupgcurl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgsudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpgecho 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.listsudo chmod 644 /etc/apt/sources.list.d/kubernetes.list   # helps tools such as command-not-found to work correctlysudo apt-get updatesudo apt-get install -y kubectl
```

4\. Customer access to [docker.mariadb.com](http://docker.mariadb.com/)

- Navigate to the [Customer Download Token at the MariaDB Customer Portal](https://customers.mariadb.com/downloads/token/).
- Log in using your [MariaDB ID](https://id.mariadb.com/).
- Copy the Customer Download Token to use as the password when logging in to the MariaDB Enterprise Docker Registry.

```
kubectl create secret docker-registry mariadb-enterprise \   --docker-server=docker.mariadb.com \   --docker-username=<email> \   --docker-password=<customer-download-token>
```

5\. Install **helm**

```
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3chmod 700 get_helm.sh ./get_helm.sh -- Check installation helm version
```

6\. Add MariaDB Enterprise Operator Helm repository to Helm configuration and Install **CRDs** (Custom Resource Definitions) for the MariaDB Enterprise Operator into your Kubernetes cluster.

```
helm repo add mariadb-enterprise-operator https://operator.mariadb.comhelm install mariadb-enterprise-operator-crds mariadb-enterprise-operator/mariadb-enterprise-operator-crds
```

7\. Install **mariadb-enterprise-operator**

a. Create a directory

```
mkdir mariadb-enterprise-operatorcd mariadb-enterprise-operator
```

b. Create a values.yaml file

```
imagePullSecrets:  - name: mariadb-enterprisewebhook:  imagePullSecrets:      - name: mariadb-enterprisecertController:  imagePullSecrets:    - name: mariadb-enterprise
```

c. Now proceed to install the operator

```
helm install mariadb-enterprise-operator mariadb-enterprise-operator/mariadb-enterprise-operator -f values.yaml
```

8\. Deploy a standalone instance of **MariaDB Enterprise Server**

- Create secret.yaml file for the root password

```
apiVersion: v1kind: Secretmetadata:  name: mariadbstringData:  password: MariaDB11!
```

- Create the secret

```
kubectl apply -f secret.yaml
```

- Create mariadb.yaml for deployment

```
apiVersion: enterprise.mariadb.com/v1alpha1kind: MariaDBmetadata:  name: mariadbspec:  rootPasswordSecretKeyRef:    name: mariadb    key: password  image: docker.mariadb.com/enterprise-server:latest  imagePullPolicy: Always  imagePullSecrets:  -  name: mariadb-enterprise  replicas: 1  port: 3306  storage:    size: 1Gi  myCnf: |    [mariadb]    bind-address=*    default_storage_engine=InnoDB    binlog_format=row    innodb_autoinc_lock_mode=2    innodb_buffer_pool_size=800M    max_allowed_packet=256M  resources:    requests:      cpu: 500m      memory: 1Gi    limits:      memory: 1Gi  metrics:    enabled: true
```

- Deploy the instance

```
kubectl apply -f mariadb.yaml
```

9\. Check the status of the deployment/troubleshooting

- Monitor the status of the pod mariadb-0 until it transitions to ‘Running

```
kubectl get pods
```

- For more details about the deployment, run

```
kubectl describe pod/mariadb-0
```

- For mariadb logs from the pod

```
kubectl logs mariadb-0
```

10\. Interact with your newly installed mariadb server on a kubernetes cluster

```
kubectl exec -it mariadb-0 -- /bin/bashmariadb -uroot -pMariaDB11!
```

**Note:** If you encounter any issues with deployment like the following:

```
kubectl get pods  Type     Reason     Age                  From               Message  ----     ------     ----                 ----               -------  Normal   Scheduled  3m6s                 default-scheduler  Successfully assigned default/mariadb-0 to minikube  Normal   Killing    35s (x3 over 2m15s)  kubelet            Container mariadb failed startup probe, will be restarted  Normal   Pulled     34s (x4 over 3m3s)   kubelet            Container image "docker.mariadb.com/enterprise-server:latest" already present on machine  Normal   Created    34s (x4 over 3m2s)   kubelet            Created container: mariadb  Normal   Started    34s (x4 over 3m2s)   kubelet            Started container mariadb  Warning  Unhealthy  5s (x10 over 2m35s)  kubelet            Startup probe failed: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
```

This indicates that there may be issues with Minikube installation itself.

To resolve this, follow these steps to delete the Minikube cluster and start fresh:

```
minikube stopminikube delete --all --purge
```

### Getting Started

The MariaDB Enterprise Kubernetes Operator is available with a MariaDB Enterprise Platform Plus subscription. Customers with that subscription plan can [download the operator here](https://staging-mdb.com/downloads/enterprise/enterprise-kubernetes-operator/).

### Conclusion

Running **MariaDB in Kubernetes** offers several advantages, like

1. **High Availability &amp; Fault Tolerance**
    - Kubernetes ensures **automatic failover** and **self-healing** of MariaDB instances.
    - StatefulSets maintain **persistent storage**, preventing data loss during pod restarts.
2. **Scalability &amp; Load Balancing**
    - Easily scale MariaDB instances **horizontally** or **vertically** based on workload demands.
    - Kubernetes **load balancing** distributes traffic efficiently across database replicas.
3. **Automated Deployment &amp; Management**
    - **MariaDB Kubernetes Operator** simplifies database provisioning, backups, and upgrades.
    - Helm charts allow **declarative configuration**, reducing manual intervention.
4. **Improved Security &amp; Isolation**
    - Kubernetes **network policies** and **RBAC (Role-Based Access Control)** enhance security.
    - Secrets management ensures **secure credential storage** for database authentication.
5. **Efficient Resource Utilization**
    - Kubernetes optimizes **CPU and memory allocation**, preventing resource wastage.
    - Containers ensure **consistent performance** across different environments.

Hopefully, this blog helps you to get started with deploying the **mariadb-enterprise-operator** in kubernetes.