Skip to content

Commit

Permalink
feat: ✨ Config: Environment Variables
Browse files Browse the repository at this point in the history
In Kubernetes deployments, environment variables enable flexible application configuration within containers. They help decouple applications from infrastructure, making them more portable and easily managed through the deployment manifest, without modifying the container image.
  • Loading branch information
kevencript committed Mar 18, 2023
1 parent 3b5e85f commit 74501cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ create-kind-cluster:
kind create cluster --config kind-config.yaml --name $(NAMESPACE)
kind export kubeconfig --name $(NAMESPACE)

apply-k8s:
deploy:
kubectl apply -f k8s

delete-k8s:
delete:
kubectl delete -f k8s

redeploy:
$(MAKE) delete
$(MAKE) deploy

port-forward:
kubectl port-forward svc/go-http-app-service 8000:80
10 changes: 7 additions & 3 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-http-app-replicaset
name: go-http-app
labels:
app: go-http-app
tier: backend
Expand All @@ -17,5 +17,9 @@ spec:
spec:
containers:
- name: go-http-app
image: wesleywillians/hello-go:v3

image: wesleywillians/hello-go:v4 # This image have the fields "NAME" & "AGE"
env:
- name: NAME
value: "Gabriel Costa"
- name: AGE
value: "23"
2 changes: 1 addition & 1 deletion k8s/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ spec:
port: 80
targetPort: 8000
protocol: TCP
type: LoadBalancer
type: ClusterIP

0 comments on commit 74501cf

Please # to comment.