Tuesday, 25 July 2023

Working with Sitecore Managed Cloud Containers - Tips!!

 I have been working with Sitecore Managed Cloud containers for the last couple months now and I thought to share some tips and information that I believe its very useful while using MC Containers, like working with The Kubernetes command-line tool, kubectl to troubleshoot issues that may happen while working on MC containers, interested, keep reading! 



Things like reviewing the status of Pods, accessing sitecore files, or accessing the actual sitecore log files are very important to know, you would need it, ask me about it :) you should have a basic knowledge of how you can do these with simple command through your local Sitecore PowerShell, want to know how, keep reading! 

The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs


 You can find useful links at the end of the post, I will list the most common commands that you need in a question and answer format below: 

How I can login into my AKS Cluster? 

Az login
az account set --subscription subscriptionId
az aks get-credentials --resource-group <name of resource group> --name <name of aks cluster> --admin
view raw gistfile1.txt hosted with ❤ by GitHub

How I can list all Pods for current Cluster? 

kubectl get pods --all-namespaces
view raw gistfile1.txt hosted with ❤ by GitHub

How I can copy files from/to MC Pod?

// From container to local
kubectl cp PODID:web.config "\support2\web.config" -n=sitecore
// From local to container
kubectl cp "\support2\web.config" PODID:web.config -n=sitecore
view raw gistfile1.txt hosted with ❤ by GitHub

If I ran into issue with one of the Pods, How I can get more information?

kubectl describe pod PODID -n=sitecore
view raw gistfile1.txt hosted with ❤ by GitHub

How I can view content of any file inside POD? 

// First run exec to get a PowerShell within the POD
kubectl exec --stdin --tty PODID -n=sitecore -- powershell
// then use cd to get into the target directoy, example to view content below
Get-Content ./web.config
view raw gistfile1.txt hosted with ❤ by GitHub


How I can browse as example CM POD from local network?

kubectl.exe port-forward cm-7965cf9c6c-b8thj -n=sitecore 9090:80
// Then use http://localhost:9090/sitecore as example
view raw gistfile1.txt hosted with ❤ by GitHub

References and useful links:

Hopefully the above helps someone! 
Please feel free to comment if you have more useful commands or if you have any comments or questions. 

No comments:

Post a Comment