-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathupgrade-aks.sh
89 lines (61 loc) · 3.17 KB
/
upgrade-aks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
az login --use-device-code
PS1='\w \$ '
# AKS
rgName='aks-solution'
aksName='rkaks'
aksName='rkaksdev'
location='canadacentral'
az aks get-credentials -g $rgName -n rkaksdev --admin
az aks get-credentials -g aks-solution -n rkaksdev --admin
# Get the current AKS cluster version
az aks show --resource-group $rgName --name $aksName --query kubernetesVersion -o tsv
# Get available AKS versions
az aks get-versions --location $location -o table
az aks get-upgrades --resource-group $rgName --name $aksName -o table
nodepoolName='agentpool'
# Check node image version
az aks nodepool show --name $nodepoolName --query nodeImageVersion --resource-group $rgName --cluster-name $aksName
az aks nodepool get-upgrades --nodepool-name $nodepoolName --resource-group $rgName --cluster-name $aksName -o table
# Upgrade a specific node pool
az aks nodepool upgrade --name $nodepoolName --resource-group $rgName --cluster-name $aksName --node-image-only
kubectl get nodes \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.kubernetes\.azure\.com\/node-image-version}{"\n"}{end}'
az aks nodepool show --name $nodepoolName --resource-group $rgName --cluster-name $aksName -o table
# check the current nodeOsUpgradeChannel value on a cluster
az aks show --resource-group $rgName --name $aksName --query "autoUpgradeProfile"
kubectl get events
az aks install-cli
# https://github.com/Azure/kubelogin#setup
# https://zaidcloud.wordpress.com/2023/05/20/install-kubelogin-on-windows-subsystem-for-linux-wsl/
VERSION=$(curl --silent "https://api.github.com/repos/int128/kubelogin/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
curl -LO "https://github.com/int128/kubelogin/releases/download/$VERSION/kubelogin_linux_amd64.zip"
unzip kubelogin_linux_amd64.zip
chmod +x kubelogin
export PATH=$PATH:"/usr/local/bin"
echo $PATH | more
which kubelogin
more ~/.kube/config
export KUBECONFIG=~/.kube/config
kubelogin convert-kubeconfig
# asdf
$HOME/.asdf/bin/asdf
$HOME/.asdf/bin/asdf plugin add kubelogin
$HOME/.asdf/bin/asdf global kubelogin latest
/home/rkadmin/.asdf/shims/kubelogin convert-kubeconfig -l azurecli
export PATH=$PATH:"/home/rkadmin/.asdf/shims/"
az aks update --resource-group $rgName --name $aksName --enable-oidc-issuer
az aks show --resource-group $rgName --name $aksName --query "oidcIssuerProfile.issuerUrl" -otsv
az aks start --resource-group $rgName --name $aksName
az resource update --name rkaks-demo --namespace Microsoft.ContainerService --resource-group $rgName --resource-type ManagedClusters
export KUBECONFIG=$HOME/.kube/config
kubelogin convert-kubeconfig -l azurecli
kubectl get pdb -A
kubectl get poddisruptionbudget istio-egressgateway -n istio-system -o yaml
kubectl patch poddisruptionbudget istio-egressgateway --type='json' -p='[{"op": "replace", "path": "/spec/disruptionsAllowed", "value": 2}]' -n istio-system
# AKS version is 1.26.10
az extension remove --name aks-preview
az extension add --name aks-preview
az extension list-available --output table
az upgrade --output table
az aks update --resource-group $rgName --name $aksName --enable-oidc-issuer
az aks show --resource-group $rgName --name $aksName --query "oidcIssuerProfile.issuerUrl" -otsv