2

## Learning k8s

Okay, seriously, wtf.. Docker container boots up just fine, but k8s startup from the same image -- fails. After deeper investigation (wasted a few hours and a LOT of patience on this) I've found that k8s is right.. I should not be working.

Apparently when you run an app in ide (IDEA) it creates the ./out/ directory where it stores all the compiled classes and resources. The thing is that if you change your resources in ./src/main/resources -- these changes do NOT reflect in ./out/. You can restart, clean your project -- doesn't matter. Only after you nuke the ./out and restart your app from IDE it will pick up your new resources.

WTF!!!

and THAT's why I was always under an impression that my app's module works well. But it doesn't, not by a tiny rat's ass!

Now the head-scratcher is WHY on Earth does Docker shows me what I want to see rather than acting responsibly and shoving that freaking error to my stdout...

Truth be told I was hoping it's k8s that's misbehaving. Oh well..

Time to get rid od legacy modes' support and jump on proper implementation! So much time wasted.. for nothing :(

Comments
  • 1
    Serverless ftw
  • 1
    Wouldn't that be an IDEA issue rather than a docker one?
  • 2
    @Commodore
    - does not boot on k8s [it shouldn't]
    - boots on idea [it shouldn't, bow I know why it does]
    - boots on standalone docker [it shouldn't, no idea why it does]
  • 1
    @netikras ermmm, "boot on docker" on the same machine than idea? 🤔
  • 1
    @netikras What the F?
    why won't you do a 2 stage docker image build? sounds like it will solve most of these problems.
  • 1
  • 1
    @magicMirror how will a multistage build help me here?
  • 2
    @netikras
    stage 1:
    Start with a clean jdk image.
    copy over code, and resources + lib jars.
    build => compiled jar + manifest.mf in it.
    stage 2:
    start from a JRE, install your spring server, and spring libs.
    copy over libs from stage 1.
    copy over compiled jar from stage 1.
    set the entrypoint.

    use stage 2 in docker or k8s, and remove stage 1 image.
    this will allow you to overcome the stale resources issue, as the build will always be clean.
  • 0
    @magicMirror makes sense. Thanks
Add Comment