This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: pref | |
| spec: | |
| selector: | |
| matchLabels: | |
| app: pref | |
| replicas: 5 | |
| template: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: PersistentVolume | |
| metadata: | |
| name: data-pv | |
| spec: | |
| storageClassName: local-storage | |
| capacity: | |
| storage: 1Gi | |
| accessModes: | |
| - ReadWriteOnce |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get the version of the api server | |
| kubectl version --short | |
| # release the hold on versions of kubeadm and kubelet | |
| sudo apt-mark unhold kubeadm kubelet | |
| # install version 1.18.5 of kubeadm | |
| sudo apt install -y kubeadm=1.18.5-00 | |
| # hold the version of kubeadm at 1.18.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get the Docker gpg key | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| # Add the Docker repository | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
| $(lsb_release -cs) \ | |
| stable" | |
| # Get the Kubernetes gpg key | |
| curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Initialize the cluster | |
| sudo kubeadm init --pod-network-cidr=10.244.0.0/16 | |
| # Set up local kubeconfig | |
| mkdir -p $HOME/.kube | |
| sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
| sudo chown $(id -u):$(id -g) $HOME/.kube/config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| az ad sp create-for-rbac \ | |
| --skip-assignment | |
| az aks create \ | |
| --resource-group myResourceGroup \ | |
| --name myAKSCluster \ | |
| --node-count 1 \ | |
| --enable-addons monitoring \ | |
| --generate-ssh-keys \ | |
| --service-principal "208-1029....." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kubectl run app \ | |
| --image=myAksAcr.azureacr.io/img:v1 \ | |
| --replicas=3 \ | |
| --port=80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| az acr create \ | |
| --resource-group myaks-rg \ | |
| --name myAksAcr \ | |
| --sku Basic \ | |
| --admin-enabled true | |
| az acr build \ | |
| --registry myAksCluster \ | |
| --image img:v1 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deploy the AKS cluster | |
| az aks create --resource-group myResourceGroup --name myAKSCluster \ | |
| --node-count 1 --enable-addons monitoring --generate-ssh-keys \ | |
| --service-principal "208-1029....." --client-secret "ba208-2......" | |
| # Set the context for kubectl | |
| az aks get-credentials --resource-group myaks-rg --name aksdeepdive | |
| # Create a deployment | |
| kubectl run nodeapp --image=aksdeepdive.azurecr.io/node:v1 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: examplepod | |
| namespace: podexample | |
| spec: | |
| volumes: | |
| - name: html | |
| emptyDir: {} | |
| containers: |
NewerOlder