Multi-Stage Continuous Deployment with GitLab, Helm and Kubernetes
95%
Understanding Helm Chart Versioning
Let's say we updated our code with a new feature and we want to deploy it. In this case, every time the code changes, the right practice is to update the image tag. For example, we can move from the v0 tag to the v1 tag:
# Export the IMAGE_REGISTRY
# (e.g., registry.gitlab.com/learning9042634/todo)
# if you didn't export it before (in .bashrc)
# export IMAGE_REGISTRY=
# Export the IMAGE_TAG (e.g., v1)
sed -i 's/IMAGE_TAG=.*/IMAGE_TAG=v1/' $HOME/.bashrc
source $HOME/.bashrc
# Docker build with the new tag
docker build -t $IMAGE_REGISTRY:$IMAGE_TAG $HOME/todo/app
# Docker push with the new tag
docker push $IMAGE_REGISTRY:$IMAGE_TAG
A change in the image should be reflected in the values.yaml file. Update the values.yaml file with the new image tag:
cat < $HOME/todo/app/manifests/helm/todo/values.yaml
replicaCount: 1
image:
repository: $IMAGE_REGISTRY
tag: $IMAGE_TAG
pullPolicy: IfNotPresent
service:
type: NodePort
port: 5000
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
imagePullSecrets:
- name: gitlab-registry
readinessProbe:
httpGet:
path: /tasks
port: 5000
initialDelaySeconds: 5
periodSeconds: 10
autoscaling:
enabled: false
serviceAccount:
create: false
ingress:Cloud Native CI/CD with GitLab
From Commit to Production ReadyEnroll now to unlock all content and receive all future updates for free.
