Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Hello-World maven Quickstart to not restart and have CrashLoopBackOffs #2788

Closed
rohanKanojia opened this issue Mar 8, 2024 Discussed in #2787 · 4 comments · Fixed by #2800
Closed

Improve Hello-World maven Quickstart to not restart and have CrashLoopBackOffs #2788

rohanKanojia opened this issue Mar 8, 2024 Discussed in #2787 · 4 comments · Fixed by #2800
Assignees
Milestone

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented Mar 8, 2024

Discussed in #2787

As discussed in below thread, we should improve quickstart to not print a simple message, which seems to cause repeated restarts.

Rather we can have it as a web application using Spring Boot/Quarkus and display a hello world HTML web page.

Originally posted by waynemorphic March 8, 2024

After following the Readme steps for a quick start of the Hello-World app, I am facing a few issues.

What works:

  • The build is successful with mvn clean install k8s:build k8s:resource k8s:apply
  • minikube start command runs minikube container in my docker desktop and opens five ports

⚠️ I have shared minikube's docker daemon environment with my shell

What does not work:

  • kubectl get pods shows:
NAME                          READY   STATUS             RESTARTS        AGE
helloworld-588b59fd98-69prl   0/1     CrashLoopBackOff   8 (2m30s ago)   18m
helloworld-85595f97f7-2x2pg   0/1     CrashLoopBackOff   8 (2m24s ago)   3h57m
  • kubectl describe pod outputs:
Type     Reason          Age                   From     Message
  ----     ------          ----                  ----     -------
  Normal   Pulling         131m (x26 over 4h1m)  kubelet  Pulling image "helloworld-java:1.16.1"
  Normal   BackOff         70m (x521 over 4h1m)  kubelet  Back-off pulling image "helloworld-java:1.16.1"
  Normal   SandboxChanged  58m                   kubelet  Pod sandbox changed, it will be killed and re-created.
  Normal   Pulling         57m (x2 over 57m)     kubelet  Pulling image "helloworld-java:1.16.1"
  Warning  Failed          57m (x2 over 57m)     kubelet  Failed to pull image "helloworld-java:1.16.1": Error response from daemon: pull access denied for helloworld-java, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          57m (x2 over 57m)     kubelet  Error: ErrImagePull
  Normal   BackOff         57m (x2 over 57m)     kubelet  Back-off pulling image "helloworld-java:1.16.1"
  Warning  Failed          57m (x2 over 57m)     kubelet  Error: ImagePullBackOff
  Normal   SandboxChanged  55m                   kubelet  Pod sandbox changed, it will be killed and re-created.
  Normal   Pulling         53m (x4 over 55m)     kubelet  Pulling image "helloworld-java:1.16.1"
  Warning  Failed          53m (x4 over 55m)     kubelet  Failed to pull image "helloworld-java:1.16.1": Error response from daemon: pull access denied for helloworld-java, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          53m (x4 over 55m)     kubelet  Error: ErrImagePull
  Warning  Failed          53m (x6 over 55m)     kubelet  Error: ImagePullBackOff
  Normal   BackOff         50m (x19 over 55m)    kubelet  Back-off pulling image "helloworld-java:1.16.1"
  Normal   SandboxChanged  41m                   kubelet  Pod sandbox changed, it will be killed and re-created.
  Normal   Pulling         39m (x4 over 41m)     kubelet  Pulling image "helloworld-java:1.16.1"
  Warning  Failed          39m (x4 over 41m)     kubelet  Failed to pull image "helloworld-java:1.16.1": Error response from daemon: pull access denied for helloworld-java, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          39m (x4 over 41m)     kubelet  Error: ErrImagePull
  Warning  Failed          39m (x6 over 41m)     kubelet  Error: ImagePullBackOff
  Normal   BackOff         26m (x61 over 41m)    kubelet  Back-off pulling image "helloworld-java:1.16.1"
  Warning  BackOff         16m (x28 over 22m)    kubelet  Back-off restarting failed container hello-world in pod helloworld-85595f97f7-2x2pg_default(42d30810-88a1-4217-8fae-80d63453a5a1)
  Normal   Pulled          69s (x10 over 22m)    kubelet  Container image "helloworld-java:1.16.1" already present on machine

The last line above shows container is present but the status is CrashLoopBackOff instead of Completed. What could I be missing?

@manusa
Copy link
Member

manusa commented Mar 8, 2024

A very simple Java 21 HttpServer with a single endpoint should do the job.

@waynemorphic
Copy link
Contributor

I can work on this

@rohanKanojia
Copy link
Member Author

@waynemorphic : Yes, I would appreciate this. Let me try to explain what needs to be done here.

  1. Remove class printing Hello World message App
  2. Use Java's inbuilt HttpServer class to create a simple HTTP server that will print some simple message at / endpoint. I remember I had tried something similar a few years ago in https://github.com/rohankanojia-forks/eclipse-jkube-demo-simple-http-server (See HttpServerApplication) . Maybe you need to tweak some things to get the desired result.
  3. Update README of quickstart with respect to new changes
  4. Update project README https://github.com/eclipse/jkube/tree/master?tab=readme-ov-file#hello-world-using-eclipse-jkube

@manusa
Copy link
Member

manusa commented Mar 11, 2024

Java 21 provides an extremely easy way to create webserver with a 2 or 3 liner code.
Just look for that online. We just need an endpoint that prints a message.

@waynemorphic waynemorphic mentioned this issue Mar 11, 2024
17 tasks
@manusa manusa added this to the 1.17.0 milestone Apr 25, 2024 — with automated-tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants