torosent / k8s-workshop-microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

k8s-workshop-microservices

Architecture

image

Challenges

Simple deployment

  1. Build the containers. Example:
docker build -t tomerplayground.azurecr.io/webstore:latest .
  1. Provision Azure Container Registry & Azure Storage
  2. Setup ACR in the K8S cluster
kubectl create secret docker-registry acr-auth --docker-server <acr-login-server> --docker-username <service-principal-ID> --docker-password <service-principal-password> --docker-email <email-address>
  1. Push the containers into ACR
  2. Get Azure storage connection string
  3. Insert the connection string in secret.yaml

to prepare secret, we need to encode it to Base64

echo -n "admin" | base64 ` or use `https://www.base64encode.org/
  1. Edit the relevant YAML files and deploy the micro-services application in K8S.
kubectl create -f . --save-config

Updating a service

  1. Update printer.cs Line 61 with a new version.
  2. Build and push the container
 docker build -t tomerplayground.azurecr.io/printingservice:latest .
 docker push tomerplayground.azurecr.io/printingservice:latest
  1. Apply the printing.yaml file.
kubectl apply -f printing.yaml

Helm

Remove the previous webstore deployment

kubectl delete deployment webstore-deployment
  1. Create Helm chart for Webstore. Example
helm create stickerstore
  1. Install Stickerstore chart
helm upgrade --install stickerstore ./stickerstore
  1. Change a value like replicaCount and upgrade
helm upgrade --install stickerstore ./stickerstore
--set replicaCount=3

Brigade

  1. Install Brigade
helm repo add brigade https://azure.github.io/brigade
helm install -n brigade brigade/brigade
  1. Create a Github token Here
  2. Create a Github webhook and connect it with brigade. Instructions
  3. Edit values.yaml and install the brigade project
helm install brigade/brigade-project -n stickerstore-project -f values.yaml
  1. Commit an edit to index.html in Webstore and watch Brigade
kubectl get pods
kubectl logs <pod-name>

Jenkins

Follow the Jenkins readme file instructions

About

License:MIT License


Languages

Language:C# 48.3%Language:HTML 28.2%Language:JavaScript 16.6%Language:Smarty 5.5%Language:Shell 1.3%