Connect Your Cluster

Inside Cluster (Service-To-Service)

Connect within the same namespace

Each cluster deployment exposes 3 services with the prefix of your cluster name.

For example, kubemq-cluster as cluster name:

Service

Name

Default Port

gRPC

kubemq-cluster-grpc

50000

Rest

kubemq-cluster-rest

9090

API

kubemq-cluster-api

8080

Connect from external namespace

Each cluster deployment exposes 3 services with the prefix of your cluster name.

Use Kubernetes DNS resolving for accessing cluster services.

For example, namespace is kubemq and cluster name is kubemq-cluster with cluster.local domain name:

Service

Name

Default Port

gRPC

kubemq-cluster-grpc.kubemq.svc.cluster.local

50000

Rest

kubemq-cluster-rest.kubemq.svc.cluster.local

9090

API

kubemq-cluster-api.kubemq.svc.cluster.local

8080

Outside Cluster

Connect with Load Balancer

Expose gRPC Load Balancer

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --grpc-expose LoadBalancer
Helm
helm install kubemq-cluster --set grpc.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
grpc:
expose: LoadBalancer

Expose Rest Load Balancer

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --rest-expose LoadBalancer
Helm
helm install kubemq-cluster --set rest.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
rest:
expose: LoadBalancer

Expose Api Load Balancer

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --api-expose LoadBalancer
Helm
helm install kubemq-cluster --set api.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
api:
expose: LoadBalancer

Connect with Node Port

Expose the required service via node port and access the service with host:port defined.

Configure gRPC Node Port

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --grpc-expose NodePort --grpc-node-port 30500
Helm
helm install kubemq-cluster --set grpc.expose=NodePort,grpc-nodePort=30500 -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
grpc:
expose: NodePort
nodePort: 30500

Configure Rest Node Port

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --rest-expose NodePort --rest-node-port 30600
Helm
helm install kubemq-cluster --set rest.expose=NodePort,rest-nodePort=30600 -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
rest:
expose: NodePort
nodePort: 30500

Configure Api Node Port

Kubemqctl
Helm
yaml
Kubemqctl
kubemqctl create cluster --api-expose NodePort --api-node-port 30700
Helm
helm install kubemq-cluster --set api.expose=NodePort,api-nodePort=30700 -n kubemq kubemq-charts/kubemq
yaml
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqCluster
metadata:
name: kubemq-cluster
namesapce: kubemq
labels:
app: kubemq-cluster
spec:
replicas: 3
api:
expose: NodePort
nodePort: 30500

Connect with Kubemqctl as Proxy

Kubemqctl CLI tool provides a very useful command which port-forward all cluster services ports of selected cluster to localhost.

Run:

kubemqctl set cluster proxy

Will show :

Current Kubernetes cluster context connection: kubernetes-local
? Select Kubemq cluster to Proxy kubemq/kubemq-cluster
Current Kubernetes cluster context connection: kubernetes-local
Connecting to kuberenets cluster...Ok.
start proxy for kubemq/kubemq-cluster-1. press CTRL C to close.
kubemq/kubemq-cluster-1:8080 -> 127.0.0.1:8080
kubemq/kubemq-cluster-1:9090 -> 127.0.0.1:9090
kubemq/kubemq-cluster-1:50000 -> 127.0.0.1:50000