Skip to content

Instantly share code, notes, and snippets.

View m8yng's full-sized avatar
🙂

Yung Shen m8yng

🙂
  • Microsoft
  • Taiwan
View GitHub Profile
@m8yng
m8yng / guideline-cloudlshell-with-krew-plugin-df-pv.md
Created September 4, 2024 07:39
Viewing PV usage of AKS cluster from Cloud Shell

Setup Steps

1. Open Cloud Shell

  • url: https://shell.azure.com/ switch to bash if not

2. Set target Subscrioption and Obtain kubeconfig

az account set --subscription $YourSubscriptionName_or_ID
az aks get-credentials --name $YourClusterName --resource-group $YourResourceGroup --overwrite-existing

3. Install krew and plugin inside Cloud Shell

@m8yng
m8yng / troubleshoot-aks-vnet-dns-server-setting.md
Last active October 18, 2023 04:06
Apply Vnet dns server setting after cluster creation.

After node/vm instances deployed, to obtain updated DNS server setting from the Vnet, the host must be restarted.

To avoid rebooting every nodes, here is an unsafe way to restart the networkd in every nodes of the cluster:

kubectl apply -f https://gist.githubusercontent.com/m8yng/8d878b022c860b47344a16e4b1f9be1d/raw/b5d831c888716d53606f1cb586a9b220c565a1c0/z_restart-networkd.yaml

Make sure remove it once its done:

kubectl delete -f https://gist.githubusercontent.com/m8yng/8d878b022c860b47344a16e4b1f9be1d/raw/b5d831c888716d53606f1cb586a9b220c565a1c0/z_restart-networkd.yaml
@m8yng
m8yng / wsl2-exe-binfmt.md
Created August 10, 2023 02:54
WSL2 tricks and workarounds

The Problem: Unable to execute .exe from WSL

The error:

$ powershell.exe
-bash: /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe: cannot execute binary file: Exec format error

# or:
@m8yng
m8yng / troubleshoot-aks-windows-nodepool.md
Last active August 10, 2023 03:00
Windows nodepool hostprocess (privileged) container daemonset

Deploy one hostprocess (privileged) container on every windows nodes in AKS

kubectl apply -f https://gist.githubusercontent.com/m8yng/b8c4115cc9c86c391686b297e75969dd/raw/4b7c7f95ac8e859d998c4cd91b76f7f1eda10b27/z_hostprocess.yaml

Then, enter the container shell:

# get the list of running pod
kubectl get pods -l app=privileged-daemonset -n kube-system -o=custom-columns=NAME:.metadata.name --no-headers
@m8yng
m8yng / troubleshoot-aks-csi-azuredisk.md
Last active August 10, 2023 03:03
Troubleshoot AKS with Azure Disk CSI driver
# Get the events
kubectl get events -l app=csi-azuredisk-node -n kube-system
# Get the logs
kubectl logs -l app=csi-azuredisk-node -n kube-system
@m8yng
m8yng / lab-aks-flannel-setup.md
Last active August 10, 2023 02:54
A quick AKS setup with flannel cni (for testing purpose)
# az aks create with 1.25+ and `--network-plugin none`
$ az aks create -g $resourceGroup -n $clusterName --kubernets-version 1.25 --network-plugin none

# Install and deploy flannel
$ export podCidrSubnet="10.244.0.0/16"
$ helm repo add flannel https://flannel-io.github.io/flannel/
$ helm install flannel --set podCidr="$podCidrSubnet" --namespace kube-flannel flannel/flannel

# Manually update the pod CIDR subnet for each nodes