Hey,
Good afternoon.
I need help solving a problem when trying to rollback a Deployment through the Rancher GUI.
When I try to rollback I get the following message:
Deployment.apps “api-notifies-php” is invalid: spec.template.metadata.labels: Invalid value: map[string]string{}: selector
does not match template labels
I’ve reviewed the Deployment manifest, adjusted the indentation, made sure the matchLabels selector is the same as the Pod labels in the templates section.
I tried several things, but I couldn’t solve this problem, in order to perform the Deployment Rollback.
Can someone help me please?
Here is my deployment:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: $K8S_DEPLOY_NAME_PHP
namespace: $K8S_NAMESPACE
labels:
app: $K8S_APP_NAME_PHP
role: $K8S_APP_ROLE
annotations:
co.elastic.logs/enabled: $ELASTIC_ANNOTATIONS_HINTS
spec:
#replicas: $K8S_APP_SCALE_MIN
strategy:
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
replicas: 1
selector:
matchLabels:
app: $K8S_APP_NAME_PHP
template:
metadata:
labels:
app: $K8S_APP_NAME_PHP
annotations:
co.elastic.logs/enabled: $ELASTIC_ANNOTATIONS_HINTS
spec:
containers:
- name: $K8S_DEPLOY_NAME_PHP
image: $K8S_DEPLOY_IMAGE_NAME_PHP:$K8S_DEPLOY_IMAGE_TAG_PHP
lifecycle:
postStart:
exec:
command:
- /bin/bash
- -c
- >
touch /var/www/storage/logs/laravel.log &&
chgrp -R www-data /var/www/bootstrap/ /var/www/storage/ /var/www/storage/logs/ &&
chmod -R g+w /var/www/bootstrap/ /var/www/storage/ /var/www/storage/logs/ &&
tail -f /var/www/storage/logs/laravel.log > /proc/1/fd/2 &
resources:
requests:
cpu: $K8S_REQUESTS_CPU_PHP
memory: $K8S_REQUESTS_MEMORY_PHP
limits:
cpu: $K8S_LIMITS_CPU_PHP
memory: $K8S_LIMITS_MEMORY_PHP
ports:
- containerPort: $K8S_DEPLOY_IMAGE_PORT_PHP
envFrom:
- configMapRef:
name: $K8S_DEPLOY_NAME_PHP