Sitemap
DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.

Member-only story

EMQX Auto Cluster on kubernetes using ETCD server

--

In this story we will try together to build an EMQX brokers Auto Cluster using an ETCD server on kubernetes. We will use in this demo Minikube local Kubernetes.

First we will begin by deploying ETCD pod using etcd-deployment.yaml file. we need only one instance of ETCD container running on the cluster.

apiVersion: apps/v1
kind: Deployment
metadata:
name: etcd-deployment
labels:
app: etcd
spec:
replicas: 1
selector:
matchLabels:
app: etcd
template:
metadata:
labels:
app: etcd
spec:
containers:
- name: etcd
image: "bitnami/etcd:latest"
imagePullPolicy: IfNotPresent
env:
- name: ALLOW_NONE_AUTHENTICATION
value: "yes"
ports:
- name: port1
containerPort: 2379
protocol: TCP
- name: port2
containerPort: 2380
protocol: TCP

Then we apply deployment:

kubectl apply -f etcd-deployment.yaml -n=dev

Now we add the etcd-service.yaml , I choose service type LoadBalancer to allow EMQX nodes to reach the etcd pod later for auto cluster registration.

apiVersion: v1
kind: Service
metadata:
name: etcd-service
spec:
selector:
app: etcd
type: LoadBalancer
ports:
- name: port1
protocol: TCP
port: 2379
targetPort: 2379
- name: port2
protocol: TCP
port: 2380
targetPort…

--

--

Mohamed Gaddour
Mohamed Gaddour

Written by Mohamed Gaddour

Certified :Associate Android Developer, Zend Certified PHP Engineer, LPI Devops, LPIC 1, ITIL.

DevOps.dev
DevOps.dev

Published in DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.