I have a multi-component platform which I created the required helm charts for it and it was properly working on Kubernetes <= 1.15.
Now I need to prepare them to be compatible with k8s 1.16. I thought that it is just enough to change the extensions/v1beta1
to apps/v1
but after I tried to install the helm charts on k8s I got this error:
Error: release test166 failed: Deployment.apps "bridge-http" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"io.kompose.service":"bridge-http"}: `selector` does not match template `labels`]
And this is my yaml/helm file which works on older k8s:
---
apiVersion: v1
kind: Service
metadata:
annotations:
Process: bridge-http
creationTimestamp: null
labels:
io.kompose.service: bridge-http
name: bridge-http
spec:
ports:
- name: "9995"
port: 9995
targetPort: 9995
selector:
io.kompose.service: bridge-http
status:
loadBalancer: {}
---
# apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
Process: bridge-http
creationTimestamp: null
labels:
io.kompose.service: bridge-http
name: bridge-http
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: bridge-http
spec:
containers:
- args:
- bash
- -c
- npm start
env:
- name: WWS_BRIDGE_HTTP_BROKER_DATA_USER
value: {{ .Values.WWS_BRIDGE_HTTP_BROKER_DATA_USER | quote }}
image: {{ .Values.image }}
name: bridge-http
readinessProbe:
tcpSocket:
port: 9995
initialDelaySeconds: 5
periodSeconds: 15
ports:
- containerPort: 9995
resources:
requests:
cpu: 0.1
memory: 250Mi
limits:
cpu: 2
memory: 5Gi
restartPolicy: Always
imagePullSecrets:
- name: wwssecret
status: {}
I couldn't find anything regarding changes in selectors and lables here: https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/
So why I am getting this error and how I can solve it?