kubernetes cluster is running on two nodes. one master , one worker ... weave net is pod network.
[root@irf-centos1 ~]# kubectl cluster-info
Kubernetes master is running at https://10.8.156.184:6443
KubeDNS is running at https://10.8.156.184:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
have deployed the rabbit docker image as container in kubernetes pod.
[root@irf-centos1 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
rabbitmq-86bd97fd9d-8h444 1/1 Running 0 51m
rabbitmq-86bd97fd9d-n2kgk 1/1 Running 0 51m
following are the service and deployment yaml file
deployment file
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: rabbitmq
spec:
replicas: 2
template:
metadata:
labels:
app: rabbitmqapp
spec:
containers:
-
image: "docker.io/rabbitmq:latest"
imagePullPolicy: Always
name: rabbitmq
ports:
-
containerPort: 5672
name: http-port
volumeMounts:
-
mountPath: /var/rabbitmqapp_home
name: rabbitmqapp-home
volumes:
-
emptyDir: {}
name: rabbitmqapp-home
service file
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
namespace: default
spec:
ports:
-
port: 5672
targetPort: 5672
protocol: TCP
nodePort: 31111
selector:
app: rabbitmqapp
type: NodePort
here are the services and deployment details
[root@irf-centos1 ~]# kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
rabbitmq 2/2 2 2 55m
[root@irf-centos1 ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 3d
rabbitmq NodePort 10.98.204.64 <none> 5672:31111/TCP 55m
now, when i am trying to hit the rabbitmq dashboard/UI on the node port. it is not accessible
[root@irf-centos1 ~]# curl http://10.8.156.187:31111
curl: (56) Recv failure: Connection reset by peer
AMQP [root@irf-centos1 ~]#
when i hit the same URL from the web browser, nothing is happening
please suggest
NOTE: this cluster is deployed using kubeadm on AZure VMs. for troubleshooting purpose, i have opened all inbound/outbound ports on these VMs so that , it should not be a firewall , port blocking issue.
Edit 1:
I modified the service file as follows and redeployed the same. PSB
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
namespace: default
spec:
ports:
- name: ui
protocol: TCP
port: 15672
targetPort: 15672
nodePort: 31112
- name: service
port: 5672
targetPort: 5672
protocol: TCP
nodePort: 31111
selector:
app: rabbitmq
type: NodePort
still getting the same error
[root@irf-centos1 ~]# curl -I http://guest:guest@10.8.156.187:31111/api/users
curl: (56) Recv failure: Connection reset by peer
AMQP [root@irf-centos1 ~]# curl -I http://guest:guest@10.8.156.187:31112/api/users
curl: (7) Failed connect to 10.8.156.187:31112; Connection refused
Actually, was using the wrong docker image ... for rabbitmq dashbaord, the docker image should be docker:management. i changed that and it worked.
here is the updated service and deployment yaml file :
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: rabbitmq
spec:
replicas: 2
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
-
image: "docker.io/rabbitmq:management"
imagePullPolicy: Always
name: rabbitmq
ports:
-
containerPort: 15672
name: http-port
volumeMounts:
-
mountPath: /var/rabbitmqapp_home
name: rabbitmqapp-home
volumes:
-
emptyDir: {}
name: rabbitmqapp-home
service yaml file :
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
namespace: default
spec:
ports:
- name: ui
protocol: TCP
port: 15672
targetPort: 15672
nodePort: 31112
- name: service
port: 5672
targetPort: 5672
protocol: TCP
nodePort: 31111
selector:
app: rabbitmq
type: NodePort
For rabbitmq dashboard/UI, it's running on : 15672
So port number in service file should be included : 15672
Then access to dashboard/UI create user for application. then curl
using this user.
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
namespace: default
spec:
ports:
-
port: 5672
targetPort: 5672
protocol: TCP
nodePort: 31111
-
protocol: TCP
port: 15672
targetPort: 15672
nodePort: 31112
selector:
app: rabbitmqapp
type: NodePort
Or using default username & password guest
of rabitmq:
curl -I http://guest:guest@10.8.156.187:31112/api/users
Deployment file add containerPort:
image: "docker.io/rabbitmq:latest"
imagePullPolicy: Always
name: rabbitmq
ports:
-
containerPort: 5672
name: http-port
containerPort: 15672
name: ui-port