Troubleshooting for Sitecore Managed Cloud Containers


Overview

This article contains instructions for troubleshooting different scenarios in Sitecore Managed Cloud Containers:

 

Prerequisites

In most cases, you need to have access to your Azure Kubernetes cluster. To connect to your cluster, use the command line tooling that allows you to interact directly with the cluster through kubectl, the command line tool for Kubernetes. kubectl  is available within the Azure Cloud Shell by default and can also be installed locally.

Tools required for accessing locally

To verify whether Azure CLI has been installed, run the following command: 

az –version

For kubectl verification, run this command:  

kubectl version --client 

An error at the output means that the Azure CLI  or kubectl  has not been installed in your system. 

If required, download and install Azure CLI or kubectl  using the links below: 

Note: If kubectl  is not working after installation from the command-line shell and every time you have to go to kubectl  folder all the time, you can add the kubectl.exe folder location in the path variable here:

Advanced System Settings -> Advanced -> Environment Variables -> Path

For example, if you have saved a file to C:\kube, then add this folder path to the path variable:

Advanced System Settings -> Advanced -> Environment Variables -> C:\kube


Connecting your cluster

After installation and verification of the prerequisites, run the following commands to connect your cluster: 

az login
az account set --subscription <Subscription-Id>
az aks get-credentials --resource-group <Resource-group-name> --name "Aks-name"*
// *AKS name is: name of your resource group + "aks".
// In most cases, the <Aks-Name> is created using the pattern: <Resource-group-name>aks
az account set --subscription <Subscription-Id>  
az aks get-credentials --resource-group <myResourceGroup> --name <myResourceGroup>aks

Note: Values in angle brackets should be replaced with the necessary ones. For example:  

az account set --subscription 525fsdf-4124-gsdg2-5fg412
az aks get-credentials --resource-group mcc5rgd325dkfkf45 --name mcc5rgd325dkfkf45aks


Configuring kubectl auto-completion for PowerShell

To configure kubectl  auto-completion for PowerShell, run the following line in your PowerShell prompt:

kubectl completion powershell >> $PROFILE

After reloading your shell, kubectl  auto-completion will be working.

Troubleshooting common issues

Сonsider the following options to investigate issues:


Useful instructions

How to access Grafana

Details on how to access Grafana can be found here:
https://doc.sitecore.com/xp/en/developers/101/managed-cloud/getting-started-with-managed-cloud-premium.html#access-grafana_body


How to access Prometheus

To access Prometheus:


How to access Elastic cloud with Kibana

For information on how to access Kibana, refer here:
https://doc.sitecore.com/xp/en/developers/102/managed-cloud/getting-started-with-managed-cloud-standard.html#access-kibana_body


How to access SearchStax

To access the SearchStax Solr instance, use the following link:

https://doc.sitecore.com/xp/en/developers/101/managed-cloud/getting-started-with-managed-cloud-premium.html#access-searchstax-solr-instance_body


How to connect to your Sitecore pod

To connect to your Sitecore pod, run the following commands:

kubectl exec -it "pod_name" -n "namespace" -- powershell
kubectl exec -it cd-c9bcbb668-8gs74 -n sitecore -- powershell

Note: in the case of the following error when trying to connect to your pod:

Error from server (Forbidden): pods "prc-75786fd57c-gz6s2" is forbidden: User "test-user@sitecore.net" cannot create resource "pods/exec" in API group "" in the namespace "sitecore""

Execute get credentials  command with elevated permissions and be a part of the DevOps  group in Identity and Access Management (IAM).

az aks get-credentials --resource-group myResourceGroup --name myResourceGroupaks --admin

To become a member of the DevOps group you can create a service request. More information on Managed Cloud security roles can be found here.


How to copy a file or folder from a pod to the local system

When connecting to the Sitecore pod, you get into C:\inetpub\wwwroot. It is the default working directory inside the pod. Copy operation will use it by default as well.  

For instance: 

kubectl cp "namespace"/"pod_name":"file_src" "file_dest"
kubectl cp sitecore/cd-c9bcbb668-8gs74:Web.config web.config 

The above command will copy the Web.config  file which is located in C:\inetpub\wwwroot  folder to your local working directory (Get-Location or pwd) with the new name "web.config".


Best practices

Deleting a pod, modifying a deployment, or forwarding a local port to a port on a pod requires a DevOps role and elevated permissions.

 Note It is required to follow the Infrastructure as Code (IAC) approach when you need to perform some actions directly into your production clusters, for example, when you tune the limits of AKS pods.
It is not recommended to perform delete or modify operations directly on your production clusters.
For more details on scaling, sizing, and tuning your Managed Cloud Container solutions, refer to Configure Managed Cloud article. If you cannot use the IAC approach for your Managed Cloud Container solution, create a service request.