I am a big fan of KUDU. Being able to run PowerShell commands where my code runs helps me to diagnose issues otherwise, it will be hard to handle.
This power (Powershell) can be used the wrong way to manipulate the files or the right way to diagnose an issue.
One of the most common issues I have faced is related to connectivity. It could be DNS, Azure SQL Firewall, Redis Firewall, Azure Web App IP restriction, or Just an enterprise firewall that blocks your application from accessing those resources.
After I started working with Kubernetes, I saw similar issues,
For example:
I have an application that accesses external resources like Storage Account, Service Bus, Redis, Mongo, and Azure SQL. Logs show the application has an issue with those resources. Now I need to determine the connectivity between the App and the external resource there or not before checking other problems like the wrong version of TLS or the wrong NuGet Package.
PowerShell Core is the cross-platform (Windows, Linux, and macOS) version of PowerShell, even if it is not as rich as PowerShell, it is still powerful.
Let’s run it on Kubernetes.
kubectl run -i --tty powershell --image=mcr.microsoft.com/powershell --restart=Never -- pwsh
“Test-Connection -TargetName google.com -TcpPort 443” can check the connectivity to google.com on port 443. For more details on PowerShell please visit https://github.com/PowerShell/PowerShell.
If you check your active Kubernetes cluster, you will see a new Pod named “powershell” on your active Namespace created. as long as the Pod is running, you can attach it whenever you need with
kubectl attach powershell -i
if you are interested on running busybox instead of powershell. More details on busybox : https://busybox.net/
kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
kubectl attach busybox -i