I have a working Azure DevOps pipeline that uses HELM to deploy my images to a Kubernetes cluster. This pipeline successfully executes when there are no resources in the cluster (the first time it is deployed). On subsequent deployments where the resources already exist, the HELM INSTALL command results in the following exception.
services "myservice-lb" already exists
Now I understand that this is due to the resource already existing, but my question relates to how to configure the chart so that changes can be deployed to the cluster.
Previously I would just run KUBECTL APPLY which is smart enough to update the pod and service if there are changes and ignore if there is nothing different. I assume HELM would have the same type of functionality, but I'm not seeing how this would be achieved.
Presently I'm using the HELM INSTALL pipeline task which points to the chart in my solution. I'm happy to post the generated YAML but I feel it's probably a command that needs to be ran in my DevOps pipeline.
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
name: myapp
spec:
replicas: 1
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
terminationGracePeriodSeconds: 30
containers:
- name: myapp
image: mycontainers.azurecr.io/myapp:latest
imagePullPolicy: "Always"
args: ["-w", "-e"]
ports:
- containerPort: 5000
resources:
limits:
cpu: 500m
requests:
cpu: 250m
imagePullSecrets:
- name: acr-auth
---
apiVersion: v1
kind: Service
metadata:
name: myservice-lb
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 5000
selector:
app: myapp