cloudnativedevops / demo

Simple demonstration app for 'Cloud Native Devops'
MIT License
799 stars 517 forks source link

hello-helm example fails to install #16

Closed tobinus closed 4 years ago

tobinus commented 4 years ago

I am following along with the examples in the book. When I try to issue the helm install command from the hello-helm/ example, I receive the following error:

Error: release demo failed: Deployment.apps "demo" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"app":"demo", "environment":"development"}: `selector` does not match template `labels`]

The release is then listed as failed:

$ helm list
NAME    REVISION    UPDATED                     STATUS  CHART       APP VERSION NAMESPACE
demo    1           Fri Nov  1 13:43:34 2019    FAILED  demo-1.0.1              default 

Complete output:

$ kubectl get all --selector app=demo
No resources found.
$ helm install --name demo ./k8s/demo
Error: release demo failed: Deployment.apps "demo" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"app":"demo", "environment":"development"}: `selector` does not match template `labels`]

The versions I run:

$ helm version
Client: &version.Version{SemVer:"v2.15.2", GitCommit:"8dce272473e5f2a7bf58ce79bb5c3691db54c96b", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.15.2", GitCommit:"8dce272473e5f2a7bf58ce79bb5c3691db54c96b", GitTreeState:"clean"}
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.7", GitCommit:"8fca2ec50a6133511b771a11559e24191b1aa2b4", GitTreeState:"clean", BuildDate:"2019-09-18T14:47:22Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.7", GitCommit:"8fca2ec50a6133511b771a11559e24191b1aa2b4", GitTreeState:"clean", BuildDate:"2019-09-18T14:39:02Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
$ docker version
Client: Docker Engine - Community
 Version:           19.03.4
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        9013bf5
 Built:             Thu Oct 17 23:44:48 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       9013bf5
  Built:            Thu Oct 17 23:50:38 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

I'm using MacOS 10.14.6 and the Kubernetes cluster set up by docker-desktop.

domingusj commented 4 years ago

Thanks for reporting this issue @tobinus and sorry the example didn't work for you.

I just pushed https://github.com/cloudnativedevops/demo/pull/17 which I think will resolve this error. If you like you could checkout that branch (bugfix/selector) and see if you are able to install the Deployment demo.

Let us know if that fix works for you.

Crokus commented 4 years ago

Once you checkout the fix branch and purge the failed helm release it works. Thanks @domingusj

tobinus commented 4 years ago

Yup, it installs successfully when I have checked out the bugfix/selector branch. Thank you!

domingusj commented 4 years ago

Cool, thanks. I'll merge that PR and close this issue. Let us know if you run into any other snags or have any questions.