https://github.com/arham09/k8s-sample
https://github.com/arham09/k8s-sample
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/arham09/k8s-sample
- Owner: arham09
- Created: 2023-10-27T15:15:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-28T12:11:33.000Z (over 2 years ago)
- Last Synced: 2025-12-26T10:47:11.715Z (6 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Config Hierarchy Demo
This project shows how to combine Config file, K8s Config Map and K8s Deployment Env,
this enable config changes without doing code changes and invoke a CI/CD Pipeline
The hierarchy will be like this
[Config File] -> [K8s Config Map] -> [K8s Deployment Env]
### Normal Config File
Start the program by
```bash
$ go run main.go
```
### K8s Config Map
Start the program by
```bash
$ kubectl apply -f deploy/deployment.yaml -n hello
```
### K8s Deployment Env
Start the program by
```bash
$ kubectl apply -f deploy/deployment.yaml -n hello
$ kubectl set env deployment/go-hello-world -n hello NAME=from_set_k8s_env
$ kubectl rollout restart deployment/go-hello-world -n hello
```
### Testing
```bash
$ curl http://:
```
The result will be different for each method used to run the program,
because we set different value for the program to run, the config file
will be parsed first, if the config with the same key available in
K8s CM or K8s Env, the value from config file will be overwritten