https://learn.microsoft.com/ja-jp/azure/aks/learn/quick-kubernetes-deploy-cli
https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/
-- 1. 前作業
az login --use-device-code
az account show
az version
az configure --list-defaults
az configure --defaults location=japaneast
az configure --list-defaults
az group create \
--name rg01 \
--location japaneast
az group list
az provider show -n Microsoft.OperationsManagement -o table
az provider show -n Microsoft.OperationalInsights -o table
az provider register --namespace Microsoft.OperationsManagement
az provider register --namespace Microsoft.OperationalInsights
-- 2. kubectlインストール
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl
kubectl version --client
az aks create \
--resource-group rg01 \
--generate-ssh-keys \
--name aks01 \
--node-count 1 \
--node-vm-size Standard_B2s
※ System node pool must use VM sku with more than 2 cores and 4GB memory.
az aks list \
--resource-group rg01
-- 4. クラスターに接続する
az aks get-credentials \
--resource-group rg01 \
--name aks01
kubectl get nodes
kubectl get pods -n kube-system
-- 5. 動作確認
kubectl cluster-info
kubectl api-resources
kubectl config view
kubectl config current-context
kubectl config use-context aks01
kubectl create deployment test --image=nginx --dry-run=client -o yaml > test.yaml
cat test.yaml
kubectl apply -f test.yaml
kubectl get deployment test
kubectl get all
kubectl delete -f test.yaml
-- 6. クリーンアップ
az group list
az group delete \
--name rg01 \
--yes
az group delete \
--name NetworkWatcherRG \
--yes