Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lukaszbudnik/b3dbb39a71e293a7e24ac571a1f9c892 to your computer and use it in GitHub Desktop.
Save lukaszbudnik/b3dbb39a71e293a7e24ac571a1f9c892 to your computer and use it in GitHub Desktop.
Shows how to setup Azure Kubernetes Service monitoring by making Kubernetes Dashboard available externally and installing EFK stack.
# az cli version
az version
{
"azure-cli": "2.5.1",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.5.1",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}
# kubectl/Kubernetes version
kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.10", GitCommit:"059c666b8d0cce7219d2958e6ecc3198072de9bc", GitTreeState:"clean", BuildDate:"2020-04-03T15:17:29Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
# helm version
helm version
version.BuildInfo{Version:"v3.2.0-rc.1", GitCommit:"7bffac813db894e06d17bac91d14ea819b5c2310", GitTreeState:"clean", GoVersion:"go1.13.10"}
# resource group name (resource group must exist)
RG_NAME=lukaszbudnik
# Azure ACR repo name
ACR_NAME=migrator
# Azure ACK cluster name
AKS_CLUSTER_NAME=awesome-product
# a little bit bigger than default cluster (3 nodes of DS3 machines)
az aks create --name $AKS_CLUSTER_NAME \
--resource-group $RG_NAME \
--load-balancer-sku basic \
--vm-set-type AvailabilitySet \
--node-count 3 \
--node-vm-size=Standard_DS3_v2 \
--enable-addons monitoring \
--attach-acr $ACR_NAME \
--no-ssh-key
# fetch credentials so that kubectl will work
az aks get-credentials --resource-group $RG_NAME --name $AKS_CLUSTER_NAME
# port forward to kubernetes-dashboard, but first fix kubernetes-dashboard roles
kubectl create clusterrolebinding kubernetes-dashboard -n kube-system --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
kubectl port-forward --namespace kube-system svc/kubernetes-dashboard 8080:80
# install EFK stack
helm repo add stable https://kubernetes-charts.storage.googleapis.com
helm install elasticsearch stable/elasticsearch
helm repo add kiwigrid https://kiwigrid.github.io
helm install fluentd kiwigrid/fluentd-elasticsearch
helm install kibana stable/kibana --set=env.ELASTICSEARCH_HOSTS=http://elasticsearch-client:9200
# port forward to kibana
POD_NAME=$(kubectl get pods --namespace default -l "app=kibana,release=kibana" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace default $POD_NAME 5601:5601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment