https://github.com/torosent/k8s-workshop-microservices
https://github.com/torosent/k8s-workshop-microservices
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/torosent/k8s-workshop-microservices
- Owner: torosent
- License: mit
- Created: 2017-10-19T09:47:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-13T11:03:55.000Z (about 7 years ago)
- Last Synced: 2025-03-28T12:21:10.549Z (2 months ago)
- Language: C#
- Size: 37.1 KB
- Stars: 3
- Watchers: 0
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k8s-workshop-microservices
## Architecture

## Challenges
### Simple deployment
1. Build the containers. Example:
```sh
docker build -t tomerplayground.azurecr.io/webstore:latest .
```
2. Provision [Azure Container Registry](https://docs.microsoft.com/en-us/azure/aks/tutorial-kubernetes-prepare-acr) & [Azure Storage](https://docs.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest#az_storage_account_create)
3. Setup ACR in the K8S cluster
```sh
kubectl create secret docker-registry acr-auth --docker-server --docker-username --docker-password --docker-email
```
4. Push the containers into ACR
5. Get Azure storage [connection string](https://docs.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest#az_storage_account_show_connection_string)
6. Insert the connection string in [secret.yaml](/Deployment/YAML/secret.yaml)**to prepare secret, we need to encode it to Base64**
```sh
echo -n "admin" | base64 ` or use `https://www.base64encode.org/
```7. Edit the relevant [YAML](/Deployment/YAML) files and deploy the micro-services application in K8S.
```sh
kubectl create -f . --save-config
```#### Updating a service
8. Update [printer.cs](PrintingService/printer.cs#L61) Line 61 with a new version.
9. Build and push the container
```sh
docker build -t tomerplayground.azurecr.io/printingservice:latest .
docker push tomerplayground.azurecr.io/printingservice:latest
```
10. Apply the [printing.yaml](/Deployment/YAML/printing.yaml) file.
```sh
kubectl apply -f printing.yaml
```### Helm
**Remove the previous webstore deployment**
```sh
kubectl delete deployment webstore-deployment
```1. Create Helm chart for Webstore. [Example](/Deployment/Helm)
```sh
helm create stickerstore
```
2. Install Stickerstore chart
```sh
helm upgrade --install stickerstore ./stickerstore
```
3. Change a value like replicaCount and upgrade
```sh
helm upgrade --install stickerstore ./stickerstore
--set replicaCount=3
```### Brigade
1. Install [Brigade](https://github.com/Azure/brigade#quickstart)
```sh
helm repo add brigade https://azure.github.io/brigade
helm install -n brigade brigade/brigade
```
2. Create a Github token [Here](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
3. Create a Github webhook and connect it with brigade. [Instructions](https://github.com/Azure/brigade/blob/master/docs/topics/github.md)
4. Edit [values.yaml](/Deployment/Brigade/values.yaml) and install the brigade project
```sh
helm install brigade/brigade-project -n stickerstore-project -f values.yaml
```5. Commit an edit to `index.html` in Webstore and watch Brigade
```sh
kubectl get pods
kubectl logs
```### Jenkins
Follow the [Jenkins](/Deployment/Jenkins/Jenkins.MD) readme file instructions