quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.78k stars 2.68k forks source link

Skaffold/Tilt example #17922

Open venkatt007 opened 3 years ago

venkatt007 commented 3 years ago

Description

It will be very helpful if we can get a sample application using kubernetes extensions properties along with skaffold/tilt so that it will be easier to get started with quarkus in kubernetes. I tries to setup but couldn't succeed. (Describe the feature here.)

Implementation ideas

Sample application with skaffold/tilt enabled for development

quarkus-bot[bot] commented 3 years ago

/cc @geoand

geoand commented 3 years ago

@iocanel have you ever used skaffold? I have not

iocanel commented 3 years ago

I have played just a little bit with it.

From what I see, it doesn't really fancy our Dockerfile placement and does require a little bit tinkering:

In other words, it needs to the user to change the context dir from src/main/docker to the module root.

Once this is done, it does seem to work smoothly (at least the skaffold run part).

geoand commented 3 years ago

Thanks @iocanel for the information.

@venkatt007 how would you expect Quarkus to help in this case?

venkatt007 commented 3 years ago

@iocanel Thanks for the info. @geoand Yes I too was facing the issue, skaffold dev was not running with some error "cannot watch files from empty dir target/quarkus-app/lib directory". May be I will try to place the Dockerfile in root folder like @iocanel mentioned and see if that works. May be some kind of this continous sync can be added as part of kubernetes extension as well to make the development environment setup easier

venkatt007 commented 3 years ago

@iocanel But I kind of tried a sample with proper context properties set. Will share the sample project here. May be you can have a quick look and help me what am I missing. My other projects with manually created Dockerfile working fine.

venkatt007 commented 3 years ago

Here is the sample which I am trying https://github.com/venkatt007/quarkus-kubernetes-quickstart

geoand commented 3 years ago

So what you need initially is a way for Quarkus to output the Kubernetes manifests in another location?

venkatt007 commented 3 years ago

@geoand Yeah. May be that would be helpful.

venkatt007 commented 3 years ago

image

This is the error i am getting

geoand commented 3 years ago

You are getting that error when doing what?

venkatt007 commented 3 years ago

when I run "skaffold dev" or "skaffold run"

iocanel commented 3 years ago

I don't see anything wrong with the manifest location. They are being picked up without issues. The only issue I see is the Dockerfile location. They are being correctly detected, but confuse skaffold into thinking that src/main/docker is the context dir.

This is fixed with something like:

apiVersion: skaffold/v2beta17
kind: Config
metadata:
  name: hello-quarkus
build:
  artifacts:
  - image: iocanel/hello-world:0.1-SNAPSHOT
    docker:
      dockerfile: src/main/docker/Dockerfile.jvm
deploy:
  kubectl:
    manifests:
    - target/kubernetes/kubernetes.json
    - target/kubernetes/kubernetes.yml

The skaffold.yaml above is the generated one, with the following changes:

With those changes skaffold runs ok-ish. By ok-ish I mean that it builds, pushes, deploys, but I do have some minor issues, mostly in that the application crashes. Not sure why yet, but it does seem like somethings wrong with the image itself. I'll update the issue with the error.

venkatt007 commented 3 years ago

@iocanel Still I am not able to get this running. Can you share a sample you tried or update in the repo I shared and push back. I am still facing the above issue after referring dockerfile and kubernetes file with absolute path without context in skaffold file as you mentioned 😞

venkatt007 commented 3 years ago

Will quarkus auto deploy kubernetes yaml in dev mode or should I run mvn package only to deploy to kubernetes cluster?