AKS cluster cli
- resource group
- aks
az_grop
export location=centralindia
export rg=aks-cluster
az group create -l $location -n $rg
aks cli
az vm list-skus --location $location \--size Standard_D2s -o table
az aks create \
--name qt-aks \
--resource-group $rg \
--node-count 2 \
--node-vm-size Standard_D2s_v4 \
--network-plugin azure \
--load-balancer-sku standard \
--enable-managed-identity \
--generate-ssh-keys
Get config and validate
alias kubectl='"/c/Program Files/Docker/Docker/resources/bin/kubectl.exe"'
echo "alias kubectl='\"/c/Program Files/Docker/Docker/resources/bin/kubectl.exe\"'" >> ~/.bashrc
az aks get-credentials --name qt-aks \
--resource-group $rg \
--overwrite-existing
kubectl get nodes
# output
NAME STATUS ROLES AGE VERSION
aks-nodepool1-25152003-vmss000000 Ready <none> 13m v1.36.5
aks-nodepool1-25152003-vmss000001 Ready <none> 13m v1.36.5
Deploy nexus on aks
- create namespace
- deploy nexus yaml files or helm
kubectl create ns nexus
1. pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nexus-data
namespace: nexus
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-csi
resources:
requests:
storage: 20Gi
2.deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nexus
namespace: nexus
labels:
app: nexus
spec:
replicas: 1 # Nexus OSS is single instance
strategy:
type: Recreate # RWO disk cannot be attached to two pods at once
selector:
matchLabels:
app: nexus
template:
metadata:
labels:
app: nexus
spec:
securityContext:
fsGroup: 200 # nexus user in the image has UID/GID 200
containers:
- name: nexus
image: sonatype/nexus3:latest
ports:
- containerPort: 8081
resources:
requests:
cpu: "500m"
memory: "2Gi"
limits:
cpu: "2"
memory: "4Gi"
readinessProbe:
httpGet:
path: /service/rest/v1/status
port: 8081
initialDelaySeconds: 60
periodSeconds: 15
livenessProbe:
httpGet:
path: /service/rest/v1/status
port: 8081
initialDelaySeconds: 120
periodSeconds: 30
volumeMounts:
- name: nexus-data
mountPath: /nexus-data
volumes:
- name: nexus-data
persistentVolumeClaim:
claimName: nexus-data
3. Service
apiVersion: v1
kind: Service
metadata:
name: nexus-svc
spec:
type: LoadBalancer
selector:
app: nexus
ports:
- port: 8081
targetPort: 8081
protocol: TCP
Get Nexus password
kubectl exec -n nexus deploy/nexus -- sh -c 'cat /nexus-data/admin.password'
Helm workflow

Steps to publish helm chart
helm create mychart
## Note update your file what you required
helm lint mychart # valaidate helm chart
helm template myapp ./mychart # genearte yaml output from helm
# Package helm chart
helm package mychart
helm package mychart --version 1.2.0 --appVersion 1.0.1
## push helm chart to nexus
curl -u admin:admin1234 \
http://20.244.66.146:8081/repository/qt-helm/ \
--upload-file mychart-0.1.0.tgz
deploy helm chart in aks
helm repo add qt-helm http://20.244.66.146:8081/repository/qt-helm/ --username admin --password admin1234
helm repo update
helm repo list
helm search repo mychart
helm search repo qt-helm/mychart --versions
helm repo update
helm search repo qt-helm/nginx --versions
helm install app qt-helm/nginx --version 1.2.0
helm upgrade -i app qt-helm/nginx --version 1.2.0-build.33.tgz
Task
- create aks cluster and deploy grafana
refer here for steps