Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

Production-AKS-Azure-Cli

shell.azure.com

https://azure.github.io/Cloud-Native/cnny-2023/fundamentals-day-4/

az login

Ref:- https://learn.microsoft.com/en-us/azure/aks/learn/quick-kubernetes-deploy-cli

Create a resource group:

az group create --name myResourceGroup --location eastus


*Create a AKS cluster.
az aks create --resource-group myResourceGroup --name myAKSCluster --enable-managed-identity --node-count 1 --generate-ssh-keys


**Connect to the cluster
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

Sample:
raj [ ~ ]$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
Merged "myAKSCluster" as current context in /home/raj/.kube/config
raj [ ~ ]$ kubectl get nodes
NAME                                STATUS   ROLES   AGE   VERSION
aks-nodepool1-11856392-vmss000000   Ready    agent   12m   v1.27.9

** delete the cluster
az group delete --name myResourceGroup --yes --no-wait

====================Storage============================================

By default AKS gives below sc's, So we don't need to create our own storage class


The default storage class looks like below.
Refer more about standard_lrs in below git.
Ref:-https://github.com/shivscloud/azure-k8-manifest/blob/main/storage-pvc.yml
Before applying pvc we don't have any pvc in cluster


wget https://github.com/shivscloud/azure-k8-manifest/blob/main/storage-pvc.yml
kubectl apply -f storage-pvc

raj [ ~ ]$ kubectl apply -f storage.yml 
storageclass.storage.k8s.io/managed-premium-retain-sc created
persistentvolumeclaim/azure-managed-disk-pvc created
configmap/usermanagement-dbcreation-script created
deployment.apps/mysql created
service/mysql created


After changes we are able to see the pvc's


==================A Simple Flask docker application migrating from docker to kuberentes====
wORKING CODE

https://github.com/shivscloud/azure-k8-manifest/blob/main/tested-flask.yml

kubectl logs postgres-deployment-6f6687c89f-bs55d -c postgres-container
 kubectl exec -it postgres-deployment-654cd6cf9-w964b  -- /bin/bash
psql -U raj -d raj_bzr8

=====================Storage Class================================
https://kubernetes.io/docs/concepts/storage/storage-classes/


Post a Comment

0 Comments

Ad Code

Responsive Advertisement