Quantcast
Channel: Chaminda's DevOps Journey with MSFT
Viewing all articles
Browse latest Browse all 342

Access Management Dashboard Locally for a RabbitMQ Cluster Deployed in AKS via Port Forwarding or nginx Ingress Controller InsidevNet

$
0
0

 We have discussed "Setting Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator" in a previous post. RabbitMQ management dashboard is a useful tool to have simple monitoring and inspecting the setup, connections etc. in the deployed RabbitMQ cluster (It is better to implement proper monitoring and alerting, which we will discuss in a next post). let' look at how to enable access to the dashboard of RabbitMQ deployed in the AKS cluster via port forwarding as well as setting up ingress via nginx.


To access the dashboard, first we need to figureout the routing. The clsuter ip service should be available by defualt with the deployment of the RabbitMQ cluster. We can execute below command to have allok at all resource in the rabbitmq namespace (Note that we ave deplyed RabbitMQ operators in rabbitmq-system namespace and the RabbitMQ cluster in the namespace rabbitmq).

kubectl get all -n rabbitmq


We can see the service/rabbitmq-cluster setup  has allowed routing to the default dashboard port of RabbitMQ that is 15672. We can inspect it further by describing the service.

  • 15672 port is for accessing mangement dashboard. 
  • 5672 is for amqp connection access, which we will discuss in a next post.
  • 15692 port we can use for monitoring which we will explore in a future post.



Access with port forward

To get initial access to the management dashboard, we can do a port forward to clsuter ip from local machine wsl/powershell where kuebectl is setup with the command below.

kubectl port-forward -n rabbitmq service/rabbitmq-cluster 15672

With port forwarding enabled we can access the management dashboard with http://localhost:15672 . It will prompt you to enter the username and password which we have defined in the "Setting Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator" . Once login we can view and manage the RabbotMQ clsuter with the dashboard.



Access with nginx route

Keeping a port forwarding always may not be preferred way of routing to services deployed in AKS (kubernetes). We can instead use nginx ingress setup such as below, which is routing traffic via nginx to cluster IP service/rabbitmq-cluster  we have discussed above. We can deploy below manifest to AKS to get the routing worked via nginx. 

You should replace  .aksblue.ch-mq-dev-eus-001.net with your own private/public dns zone route. We can include the below yaml in the rabbitmq-cluster.yaml which we discussed in the "Setting Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator"  to get the ingress setup, deployed via azure pipelines using the  install-rabbitmq.ps1 as described in the  "Setting Up RabbitMQ Cluster Operator and Topology Operator via Azure Pipelines in AKS"..

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rabbitmq
  namespace: rabbitmq
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/proxy-body-size: 4g
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "30"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "30"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "30"
    nginx.ingress.kubernetes.io/proxy-max-temp-file-size: "0"
spec:
  ingressClassName: nginx
  rules:
  - host: rabbitmq-dashboard.aksblue.ch-mq-dev-eus-001.net
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: rabbitmq-cluster
            port:
              number: 15672

Note that, if you are using  private dns zone routing you can only access with a VPN connectivity to your Azure network which is out of scope of this post. If it is public dns routing you can access locally via internet.

Private dns zone exampe shown below with terraform.

# Private dns zone for AKS
resource"azurerm_private_dns_zone""aks" {
  name               ="${var.PREFIX}-${var.PROJECT}-${var.ENVNAME}.net"
  resource_group_name=azurerm_resource_group.instancerg.name
}

# Link private dns zone for AKS to env vnet
resource"azurerm_private_dns_zone_virtual_network_link""aks" {
  name                 ="environment"
  private_dns_zone_name=azurerm_private_dns_zone.aks.name
  resource_group_name  =azurerm_private_dns_zone.aks.resource_group_name
  virtual_network_id   =azurerm_virtual_network.env_vnet.id
  registration_enabled =false
}

# Private dns a record for AKS Nginx Private IP - blue
resource"azurerm_private_dns_a_record""aks_nginx_blue" {
  name               ="*.${local.aks_dns_prefix_blue}"
  zone_name          =azurerm_private_dns_zone.aks.name
  resource_group_name=azurerm_private_dns_zone.aks.resource_group_name
  ttl                =3600
  records            =[var.PRIVATE_IP_NGINX_BLUE]
}

# Private dns a record for AKS Nginx Private IP - green
resource"azurerm_private_dns_a_record""aks_nginx_green" {
  name               ="*.${local.aks_dns_prefix_green}"
  zone_name          =azurerm_private_dns_zone.aks.name
  resource_group_name=azurerm_private_dns_zone.aks.resource_group_name
  ttl                =3600
  records            =[var.PRIVATE_IP_NGINX_GREEN]
}


 We can access RabbitMQ management dashboard with nginx routing. Note that we have not enabled ssl for the RabbitMQ deployment in AKS and the access is via http. We can explore SSL setup in a future post.




Viewing all articles
Browse latest Browse all 342

Trending Articles