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:
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:
kubemq-cluster-grpc.kubemq.svc.cluster.local
kubemq-cluster-rest.kubemq.svc.cluster.local
kubemq-cluster-api.kubemq.svc.cluster.local
Outside Cluster
Connect with Load Balancer
Expose gRPC Load Balancer
kubemqctl create cluster --grpc-expose LoadBalancer
helm install kubemq-cluster --set grpc.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
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 create cluster --rest-expose LoadBalancer
helm install kubemq-cluster --set rest.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
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 create cluster --api-expose LoadBalancer
helm install kubemq-cluster --set api.expose=LoadBalancer -n kubemq kubemq-charts/kubemq
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 create cluster --grpc-expose NodePort --grpc-node-port 30500
helm install kubemq-cluster --set grpc.expose=NodePort,grpc-nodePort=30500 -n kubemq kubemq-charts/kubemq
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 create cluster --rest-expose NodePort --rest-node-port 30600
helm install kubemq-cluster --set rest.expose=NodePort,rest-nodePort=30600 -n kubemq kubemq-charts/kubemq
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 create cluster --api-expose NodePort --api-node-port 30700
helm install kubemq-cluster --set api.expose=NodePort,api-nodePort=30700 -n kubemq kubemq-charts/kubemq
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