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

[Maven Quickstarts]: hello-world curl request fails #3327

Open
2 tasks
lcardito opened this issue Aug 20, 2024 · 9 comments
Open
2 tasks

[Maven Quickstarts]: hello-world curl request fails #3327

lcardito opened this issue Aug 20, 2024 · 9 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@lcardito
Copy link
Contributor

Component

Kubernetes Maven Plugin

Task description

Description

Hey team, apologies if this is not the right type. This seems to be a docs issue potentially rather than anything else.

Running the helloworld quickstart curl test does not return any response.

I've ran all the steps in the README.md for the helloworld quick start. I can see the pod running no issues, however when running the curl test I get a "Couldn't connect to server" error.

❯ kubectl get svc
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
helloworld   NodePort    10.106.132.58   <none>        8080:32374/TCP   57s
kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP          27m
❯ curl $(minikube ip):$(kubectl get svc helloworld -n default -o jsonpath='{.spec.ports[].nodePort}')
curl: (28) Failed to connect to 192.168.58.2 port 32374 after 75002 ms: Couldn't connect to server

I found a related issue with Micronaut #1429, in the helloworld example as well we might want to update the docs once I can get it running 😄

Expected Behavior

Running the helloworld quickstart curl Hello World

Acceptance Criteria

  • hello-work runs locally
  • docs are updated replacing the hardcoded node port with the kubectl command
@rohanKanojia
Copy link
Member

@lcardito : Hello, thanks a lot for trying out the project.

I tried reproducing the issue but I couldn't reproduce it. Could you please check if it works if you use minikube service command like this?

curl `minikube service helloworld --url`/hello

Maybe application isn't build correctly? Have you packaged your application using mvn package first? Do you see anything fishy when you do mvn k8s:log?

@lcardito
Copy link
Contributor Author

Hey @rohanKanojia I am trying to get to the bottom of it. I think my docker setup on the M1 mac might have something todo with it.

From mvn k8s:log everything looks ok

❯ mvn k8s:log
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.eclipse.jkube.quickstarts.maven:helloworld >-----------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: Hello World 1.17.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- k8s:1.17.0:log (default-cli) @ helloworld ---
[INFO] k8s: Using Kubernetes at https://127.0.0.1:32769/ in namespace null with manifest /Users/card74944/projects/jkube/quickstarts/maven/hello-world/target/classes/META-INF/jkube/kubernetes.yml
[INFO] k8s: Watching pods with selector LabelSelector(matchExpressions=[], matchLabels={app=helloworld, provider=jkube, group=org.eclipse.jkube.quickstarts.maven, app.kubernetes.io/name=helloworld, app.kubernetes.io/part-of=org.eclipse.jkube.quickstarts.maven, app.kubernetes.io/managed-by=jkube}, additionalProperties={}) waiting for a running pod...
[INFO] k8s:  [NEW] helloworld-65876ffb54-v8xhr status: Running Ready
[INFO] k8s:  [NEW] Tailing log of pod: helloworld-65876ffb54-v8xhr container: hello-world
[INFO] k8s:  [NEW] Press Ctrl-C to stop tailing the log
[INFO] k8s:  [NEW]
[INFO] k8s: Aug 21, 2024 8:32:19 AM org.eclipse.jkube.sample.helloworld.App main
[INFO] k8s: INFO: Server started on port: 8080

The following command

❯ curl `minikube service helloworld --url`/hello
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

is pointing me at something similar to kubernetes/minikube#13788 (comment). Did not manage to make it work yet, I'll spend some more time troubleshooting later on today.

@rohanKanojia
Copy link
Member

@lcardito : If this issue is blocking you maybe you can try some cloud Kubernetes provider. Red Hat provides a developer sandbox with which you can create a small OpenShift cluster . It's good enough for experimenting.

@lcardito
Copy link
Contributor Author

@rohanKanojia - bingo. As mentioned in the linked issue on darwin looks like we need to access the service via an ssh tunnel. Doing

❯ minikube service helloworld --url
http://127.0.0.1:64657

and then hitting that url with

❯ curl http://127.0.0.1:64657/hello
Hello World%

works.

It is worth it for this project to also update the docs to run those quickstarts on MacOs? (unsure if it's only with M1 macs though..)

@rohanKanojia
Copy link
Member

@lcardito : Feel free to update the docs to make it easier for newcomers to troubleshoot issues like these.

@manusa manusa added the documentation Improvements or additions to documentation label Aug 27, 2024
@manusa
Copy link
Member

manusa commented Aug 27, 2024

the doc for this quickstart is not consistent with the rest, we should use always minikube service to retrieve the valid URL.

@lcardito
Copy link
Contributor Author

@manusa yeah - can you leave it with me? I can put together a PR to make it consistent and add a note for the new mac M1 onwards

@rohanKanojia
Copy link
Member

@lcardito : polite ping, are you still working on this issue?

@lcardito
Copy link
Contributor Author

@lcardito : polite ping, are you still working on this issue?

Hey @rohanKanojia , apologies I'm traveling at the moment! Should be able to get some time to sort this out later next week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants