-
Create a namesapce called "bp-rq"
kubectl create ns bp-rq
-
Apply the Resource Quota
kubectl apply -f ./assets/lab-05/resource-quota.yaml -n bp-rq
-
Verify that
Used
is 0.kubectl describe quota -n bp-rq
-
Create a
high-priority
podkubectl apply -f ./assets/lab-05/high-priority-pod.yml -n bp-rq
-
Verify that the quote has updated
kubectl describe quota -n bp-rq
-
Create a namesapce called "bp-lr"
kubectl create ns bp-lr
-
Apply the Limit Range
kubectl apply -f ./assets/lab-05/limit-range.yaml -n bp-lr
-
Describe the Limit Range
kubectl describe limitrange/limit-mem-cpu-per-container -n bp-lr
-
Create a Pod which define some resource
kubectl apply -f ./assets/lab-05/resourced-pod.yaml -n bp-lr
-
Review each container in turn
kubectl describe po/busybox1 -n bp-lr
-
Update your AKS cluster to enable the Cluster Autoscaler.
az aks update \ --resource-group <aks-resource-group> \ --name <aks-cluster-name> \ --enable-cluster-autoscaler \ --min-count 2 \ --max-count 5
-
Create a namespace called 'wordpress'
kubectl create ns wordpress
-
Deploy wordpress using Helm:
helm install wp-release stable/wordpress --namespace wordpress
We will explore Helm in detail tomorrow.
-
Enable autoscaling:
kubectl autoscale deployment wp-release-wordpress --cpu-percent=50 --min=1 --max=3 -n wordpress
-
Review HPA:
kubectl get hpa -n wordpress
-
Create new namespace:
kubectl create ns bp-pvc
-
Create a PVC using default storage class, and a pod:
kubectl apply -f ./assets/lab-05/pvc.yaml -n bp-pvc
-
Show disk created in Azure portal
-
Create a pod, and mount the disk.
-
Get a shell running, and create a new file in the mounted volume:
kubectl exec -it mypod2 -n bp-pvc -- /bin/bash cd /mnt/mydemo hostname >> host.txt cat host.txt
-
Exit the shell, and delete the Pod.
kubectl delete pod mypod2 -n bp-pvc
-
Recreate the pod
kubectl apply -f ./assets/lab-05/pvc.yaml -n bp-pvc
-
Verify the file still exists:
kubectl exec -it mypod2 -n bp-pvc -- /bin/bash cd /mnt/mydemo ls cat host.txt
-
Get the volume
kubectl get pvc my-data-store2 -n bp-pvc
-
Query for the disk Id
az disk list --query '[].id | [?contains(@,`pvc-7f700aa1-a3bd-4017-971c-ee054c3cf26a`)]' -o tsv
-
Create a snapshot:
az snapshot create \ --resource-group <cluster-mv-resource-group> \ --name pvcSnapshot \ --source <disk-id>
-
Create a new disk
az disk create --resource-group <cluster-mv-resource-group> --name pvcRestored --source pvcSnapshot
-
Get the disk ID
az disk show --resource-group <cluster-mv-resource-group> --name pvcRestored --query id -o tsv
-
Update "restored-disk.yaml" with the disk ID. Create a pod, mounting the restored disk:
code ./assets/lab-05/restored-disk.yaml kubectl apply -f ./assets/lab-05/restored-disk.yaml -n bp-pvc
-
Verify the file still exists:
kubectl exec -it mypodrestored -n bp-pvc -- /bin/bash cd /mnt/mydemo ls cat host.txt