Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 2.48 KB

01-commands.md

File metadata and controls

63 lines (44 loc) · 2.48 KB

Login to azure

az login

Create a resource group

az group create --name getting-started-with-microservices --location westeurope

Create a container registry

az acr create --resource-group getting-started-with-microservices --name gettingstartedregistry --sku Basic

Log into the registry

az acr login --name gettingstartedregistry

Build a docker image

docker build -f ScaffoldedWebApi\Dockerfile -t "getting-started-app:latest" .

Tag the docker image with a registry domain

docker tag getting-started-app:latest gettingstartedregistry.azurecr.io/getting-started-app:latest

Push an image into registry

docker push gettingstartedregistry.azurecr.io/getting-started-app:latest

Create an Azure container instance

az acr update -n gettingstartedregistry --admin-enabled true

az acr credential show --name gettingstartedregistry --query "passwords[0].value"

az container create --resource-group getting-started-with-microservices --name gettingstartedinstance --image gettingstartedregistry.azurecr.io/getting-started-app:latest --registry-username gettingstartedregistry --registry-password --dns-name-label getting-started-instace --ports 80

http://getting-started-instace.westeurope.azurecontainer.io/api/helloworld

Create Service Principal for role base access

az ad sp create-for-rbac --skip-assignment

Connect RBAC with Registry

az acr show --resource-group getting-started-with-microservices --name gettingstartedregistry --query "id" --output tsv

az role assignment create --assignee --scope --role Reader

Create Azure Kubernetes Service

az aks create --resource-group getting-started-with-microservices --name gettingstartedcluster --node-count 1 --service-principal --client-secret --generate-ssh-keys

Connecting to the AKS clustes

az aks get-credentials --resource-group getting-started-with-microservices --name gettingstartedcluster

kubectl get nodes

Kubectl commands

kubectl apply -f kubernetes\deployment.yaml kubectl get deployments kubectl apply -f kubernetes\service.yaml kubectl get svc -w kubectl scale deployment scaffolded-deployment --replicas=2 kubectl delete deployment scaffolded-deployment kubectl apply -f kubernetes\statefulset.yaml kubectl scale deployment scaffolded-statefulset --replicas=2

Navigation:

  1. Readme
  2. Prerequisites
  3. Docker
  4. Kubernetes
  5. Commands