It would be usefull to figure out how many pods running in a given AKS cluster sometimes for various diagnostic needs. In this post let's see how we can use kubectl command to get pod count in diffrent combinations.
Below are some examples.
It would be usefull to figure out how many pods running in a given AKS cluster sometimes for various diagnostic needs. In this post let's see how we can use kubectl command to get pod count in diffrent combinations.
Below are some examples.
Sometimes we might have to update resource allocations (memory and CPU) in AKS deployed apps without full redeployment. In such cases we can easly use kubectl to patch the deployment so it increase or reduce resources as we need it and gradually apply to running pods by restartting them gracefully. Let's see how.
We have discussed "Setting Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator" and how to expose dashboard with "Access Management Dashboard Locally for a RabbitMQ Cluster Deployed in AKS via Port Forwarding or Nginx Ingress Controller Inside VNet". Using the same Nginx route we can setup app gateway route rule so that the RabbitMQ dashboard can be accessed public url.
The expectation is to route via App Gateway as shown below..
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.
Once a RabbitMQ cluster is deployed on AKS as described in "Setting Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator" it would be grat to test if the deployment is working as expected. For this purpose we can use a perf-test . Let's run a perf-test step by step for RabbitMQ in AKS cluster using wsl in this post.
Expectation is to run a performance test as shown below.
We have discused "Setting Up RabbitMQ Cluster Operator and Topology Operator via Azure Pipelines in AKS" in the previous post. The deployed cluster oprator in AKS can be used deploy a RabbitMQ cluster. In this post let's explore deploying a production ready RabbitMQ Cluster in AKS (without TLS/SSL - we will explore that in a future post), to be used with apps deployed in same AKS cluster.
Once successfully deployed the RabbitMQ clsuter the rabbitmq namcspace should have resources shown in the below image. We are deploying a three node RabbitMQ cluster, each pod scheduled in a different Azure availability zone node. Cluster access setup with service/rabbitmq-cluster ClusterIP, as we only need access within AKS cluster for apps. How to use it for local development, we can discuss in a future post.
Using operators to setup RabbitMQ cluster in AKS (kubernetes) is a recomended approach. There are two RabbitMQ operators we need to deploy into AKS for setting up a RabbitMQ cluster and managing message setup in the deployed RabbitMQ cluster.
Sometmes it would be necessery to identify which priority classes are used in each pod in a kubernetes environment, specially to plan and reorganize priorities in apps deployed. Let's look at a query to view pods with priority classes using kubectl.
Below command will get all pods in all namespaces with their priority classes name and priority value. The highest priority number value is the highet priority.
kubectl logs command helps us to inspect logs of pods in AKS/kubernetes and useful to diagnose issues. However, when there is too much logs it is harder to read through and find out errors easily. Further, filtering out logs for a given timestamp may be useful at times to identify the issues. In this post let's explore usage of grep with kubectl logs command to filter logs.
Let's take first example to filter for a timestamp in keda operator pod logs. Here -i says to ignore case in logs.
kubectl logs keda-operator-79d756dd66-69gsc -n keda | grep -i '2025-03-04T07:20:24'
We may sometimes want to jump into a container deployed in kubernetes pod to investigate the conntents of a container, such as files in it or even we may want to run commands and see how they work inside a deployed container. For that purpose we need to jump into the container and obtian the command shell in that container. Let's look at how we can jump into both Linux and Windows containers.
Kubectl is the command line which will help to do everything with AKS or any other kubernetes set up. To setup or update kubectl on WSL follow the steps below.
az aks get-credentials is used to get the kubeconfig updated so that we can access AKS clusters from a terminal (You need to first use az login and az account set --subscription to connect to your Azure subscription). You may encounter Unable to connect to the server: getting credentials: exec: executable kubelogin not found issue after geting credentials and when trying to execute kubectl commands such as kubectl get namespace. Let's see what we need to do to get the issue resolved.