So to continue my exercise of archiving commands I wanted to turn my attention to Azure Kubernetes (AKS).  Again, this is my second time around and I managed to pretty much forget all the important commands along with the order and context. This time round I was exercising a new tool I have helped develop called dotnet-monitor, an experimental tool that makes it easier to get access to diagnostics information in a dotnet process. I will blog about this shortly.

k8s-azure

# Login
az login

# Show what account you have ensure it is using the correct subscription
az account show

# set to the correct subscription if necessary
az account set --subscription 500f8ge0-b9fe-4e34-a233-12e5432f650h

# Execute this command at your user root e.g. c:\users\madownie
az aks get-credentials -n web-aks -g web-aks-resource-group

# Kubernets dashboard, browse to the site to a list of APIs
kubectl proxy

# list services (and IP address)
kubectl get services

# get namespaces
kubectl get namespaces

# Enable RBAC (role based access control)
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

# Deployment YAML
kubectl create -f dasblog.yml

# Update your container where in the new yaml file you just update the "image" string
kubectl apply -f dasblog.yml

# Ensures everthing is connected. Manages the cluster at the command line.
kubectl cluster-info

# See the Kube UI
az aks browse --name web-aks --resource-group web-aks-resource-group

# Health of the pod
kubectl describe pod eshopweb-7d6ddd959d-lcxt9

# IP Address and port info
kubectl get services

# list of pods
kubectl get pods

# port forward
kubectl port-forward pods/eshopweb-8464dc5cf6-p4m4q 7000:52323

# Log into Azure image registry
az acr login --name aks-registry

# Update an AKS cluster with ACR integration
az aks update -n web-aks -g web-aks-resource-group --attach-acr aks-registry