Last active
February 26, 2018 00:44
-
-
Save marcellodesales/a8bf991b846731a1887f741b63ede887 to your computer and use it in GitHub Desktop.
How can I fix the Helm Error while deploying an app to Kubernetes K8S "Error: release config-service failed: Deployment.apps "config-service" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"app":"config-service", "release":"config-service"}: `selector` does not match template `labels`]"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Patterns to ignore when building packages. | |
# This supports shell glob matching, relative path matching, and | |
# negation (prefixed with !). Only one pattern per line. | |
.DS_Store | |
# Common VCS dirs | |
.git/ | |
.gitignore | |
.bzr/ | |
.bzrignore | |
.hg/ | |
.hgignore | |
.svn/ | |
# Common backup files | |
*.swp | |
*.bak | |
*.tmp | |
*~ | |
# Various IDEs | |
.project | |
.idea/ | |
*.tmproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: 1.3.0-RELEASE | |
appVersion: 1.1.5-SNAPSHOT | |
description: A Helm chart for Configuration service in Kubernetes | |
name: config-service | |
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy the current app named witht the branch name as the pod name | |
helm install --debug \ | |
--set replicaCount=3 \ | |
--name $(git rev-parse --abbrev-ref HEAD) config-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helm install --debug --namespace d8b21ce --name d8b21ce --set replicaCount=3 --set ingress.enabled=true --set ingress.hosts={d8b21ce-api.config-reference.a.company.com} config-service | |
[debug] Created tunnel using local port: '42955' | |
[debug] SERVER: "127.0.0.1:42955" | |
[debug] Original chart version: "" | |
[debug] CHART PATH: /tmp/apps/config-service/deploy/k8s/helm-chart/config-service | |
Error: release config-service failed: Deployment.apps "config-service" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"app":"config-service", "release":"config-service"}: `selector` does not match template `labels`] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: {{ template "config-service.fullname" . }} | |
labels: | |
app: {{ template "config-service.name" . }} | |
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | |
release: {{ .Release.Name }} | |
heritage: {{ .Release.Service }} | |
spec: | |
replicas: {{ .Values.replicaCount }} | |
template: | |
metadata: | |
labels: | |
app: {{ template "config-service.name" . }} | |
release: {{ .Release.Name }} | |
spec: | |
imagePullSecrets: | |
- name: regsec | |
containers: | |
- name: {{ .Chart.Name }} | |
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | |
imagePullPolicy: {{ .Values.image.pullPolicy }} | |
ports: | |
- containerPort: {{ .Values.service.port }} | |
livenessProbe: | |
initialDelaySeconds: 45 | |
periodSeconds: 5 | |
httpGet: | |
path: / | |
port: {{ .Values.service.port }} | |
readinessProbe: | |
initialDelaySeconds: 45 | |
periodSeconds: 5 | |
httpGet: | |
path: / | |
port: {{ .Values.service.port }} | |
env: | |
{{- range $key, $value := .Values.environment }} | |
- name: {{ $key }} | |
value: {{ $value }} | |
{{- end}} | |
resources: | |
{{ toYaml .Values.resources | indent 12 }} | |
{{- if .Values.nodeSelector }} | |
nodeSelector: | |
{{ toYaml .Values.nodeSelector | indent 8 }} | |
{{- end }} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{/* vim: set filetype=mustache: */}} | |
{{/* | |
Expand the name of the chart. | |
*/}} | |
{{- define "config-service.name" -}} | |
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |
{{- end -}} | |
{{/* | |
Create a default fully qualified app name. | |
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |
If release name contains chart name it will be used as a full name. | |
*/}} | |
{{- define "config-service.fullname" -}} | |
{{- if .Values.fullnameOverride -}} | |
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |
{{- else -}} | |
{{- $name := default .Chart.Name .Values.nameOverride -}} | |
{{- if contains $name .Release.Name -}} | |
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |
{{- else -}} | |
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |
{{- end -}} | |
{{- end -}} | |
{{- end -}} | |
{{/* | |
Create chart name and version as used by the chart label. | |
*/}} | |
{{- define "config-service.chart" -}} | |
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- if .Values.ingress.enabled -}} | |
{{- $serviceName := include "config-service.fullname" . -}} | |
{{- $servicePort := .Values.service.port -}} | |
{{- $serviceHealthPath := .Values.service.healthCheckPath -}} | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: {{ template "config-service.fullname" . }} | |
labels: | |
app: {{ template "config-service.name" . }} | |
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | |
release: {{ .Release.Name }} | |
heritage: {{ .Release.Service }} | |
annotations: | |
{{- range $key, $value := .Values.ingress.annotations }} | |
{{ $key }}: {{ $value | quote }} | |
{{- end }} | |
spec: | |
rules: | |
{{- range $host := .Values.ingress.hosts }} | |
- host: {{ $host }} | |
http: | |
paths: | |
- path: {{ $serviceHealthPath }} | |
backend: | |
serviceName: {{ $serviceName }} | |
servicePort: {{ $servicePort }} | |
{{- end -}} | |
{{- if .Values.ingress.tls }} | |
tls: | |
{{ toYaml .Values.ingress.tls | indent 4 }} | |
{{- end -}} | |
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: {{ template "config-service.fullname" . }} | |
labels: | |
app: {{ template "config-service.name" . }} | |
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | |
release: {{ .Release.Name }} | |
heritage: {{ .Release.Service }} | |
spec: | |
type: {{ .Values.service.type }} | |
ports: | |
- port: {{ .Values.service.port }} | |
protocol: TCP | |
name: {{ .Values.service.name }} | |
# selector: | |
# app: {{ template "config-service.name" . }} | |
# release: {{ .Release.Name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default values for config-service. | |
# This is a YAML-formatted file. | |
# Declare variables to be passed into your templates. | |
replicaCount: 1 | |
image: | |
repository: docker.artifactory.a.company.com/cto/developer/services/config | |
tag: latest | |
pullPolicy: IfNotPresent | |
service: | |
name: config | |
type: ClusterIP | |
port: 8888 | |
healthCheckPath: / | |
ingress: | |
enabled: true | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
#kubernetes.io/tls-acme: "true" REDIRECT FROM HTTP TO HTTPS | |
path: / | |
hosts: | |
- api.config-reference.a.company.com | |
#tls: | |
# - secretName: cert | |
# hosts: | |
resources: | |
# We usually recommend not to specify default resources and to leave this as a conscious | |
# choice for the user. This also increases chances charts run on environments with little | |
# resources, such as Minikube. If you do want to specify resources, uncomment the following | |
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | |
limits: | |
cpu: 1000m | |
memory: 2048Mi | |
requests: | |
cpu: 500m | |
memory: 2048Mi | |
nodeSelector: {} | |
tolerations: [] | |
affinity: {} | |
environment: | |
SPRING_PROFILES_ACTIVE: dev,dev_aws,container,onboard_preprod | |
# Will bootstrap from the branch/label/sha | |
SPRING_CLOUD_CONFIG_LABEL: develop | |
###### Java Environment | |
# JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y | |
# JAVA_PARAMS: -Dlog4j2.StatusLogger.level=DEBUG -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=DEBUG | |
# SPRING_BOOT_APP_OPTS: | |
# https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html#boot-features-custom-log-levels | |
LOGGING_LEVEL_ROOT: DEBUG | |
###### JSK Environment | |
JSK_SPRING_CONFIG_IDPS_CONNECTION_API_SECRET_KEY: /resources/certs/key_v2-e6aa136516cd7.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment