File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -187,3 +187,20 @@ See https://learn.microsoft.com/en-us/azure/cosmos-db/database-encryption-at-res
187187Minimum level of shown logs can be configured by the ` LOG_LEVEL ` env var.
188188
189189Populate the ` LOGGLY_TOKEN ` env var for logs to be sent to Loggly.
190+
191+ ## Running in k8s
192+
193+ 1 . Install ` kubectl ` and ` minikube `
194+ 2 . Build a prod image: ` docker build --target production --tag todo-app:prod . `
195+ 3 . Load the image into minikube: ` minikube image load todo-app:prod `
196+ 4 . Create the secret for env variables:
197+ ``` shell
198+ kubectl create secret generic container-env \
199+ --from-literal=FLASK_APP=' todo_app/app' \
200+ --from-literal=MONGODB_PRIMARY_CONNECTION_STRING=' <DELIBERATELY MISSING>' \
201+ --from-literal=LOGGLY_TOKEN=' <DELIBERATELY MISSING>' \
202+ --from-literal=LOG_LEVEL=' DEBUG'
203+ ```
204+ 5 . Apply the k8s YAML files: ` kubectl apply -f deployment.yaml -f service.yaml `
205+ 6 . Expose the port: ` kubectl port-forward service/module-14 7080:80 `
206+ 7 . Open http://localhost:7080 to view the app
Original file line number Diff line number Diff line change 1+ apiVersion : apps/v1
2+ kind : Deployment
3+ metadata :
4+ name : module-14
5+ spec :
6+ selector :
7+ matchLabels :
8+ app : module-14
9+ replicas : 1
10+ template :
11+ metadata :
12+ labels :
13+ app : module-14
14+ spec :
15+ containers :
16+ - name : " todo-app"
17+ image : " todo-app:prod"
18+ ports :
19+ - containerPort : 8000
20+ imagePullPolicy : " Never"
21+ envFrom :
22+ - secretRef :
23+ name : container-env
Original file line number Diff line number Diff line change 1+ kind : Service
2+ apiVersion : v1
3+ metadata :
4+ name : module-14
5+ spec :
6+ type : NodePort
7+ selector :
8+ app : module-14
9+ ports :
10+ - protocol : TCP
11+ port : 80
12+ targetPort : 8000
You can’t perform that action at this time.
0 commit comments