Skip to content

Commit

Permalink
feat: ✨ Config: Configmaps
Browse files Browse the repository at this point in the history
ConfigMaps in Kubernetes are a flexible way to store and manage non-sensitive configuration data for your applications, enabling you to decouple configuration settings from container images and simplifying updates and maintenance.
  • Loading branch information
kevencript committed Mar 18, 2023
1 parent 74501cf commit b4c980a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ delete:
redeploy:
$(MAKE) delete
$(MAKE) deploy
sleep 3
$(MAKE) port-forward

port-forward:
kubectl port-forward svc/go-http-app-service 8000:80
7 changes: 7 additions & 0 deletions k8s/configmap-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: go-http-app-env
data:
NAME: "Gabriel Costa"
AGE: "36"
10 changes: 8 additions & 2 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
image: wesleywillians/hello-go:v4 # This image have the fields "NAME" & "AGE"
env:
- name: NAME
value: "Gabriel Costa"
valueFrom:
configMapKeyRef:
key: NAME
name: go-http-app-env
- name: AGE
value: "23"
valueFrom:
configMapKeyRef:
key: AGE
name: go-http-app-env

0 comments on commit b4c980a

Please # to comment.