News for hackers. Stuff that matters.
Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @11:51AM (#24178735)
> Run your applications in Docker from day 1 (with docker-compose it’s as valuable for dev as it is for production) and think carefully before letting your applications store local state.

I think this is the key take away for many startups. Get it so you:

    1. Have a single-command way to bring up your entire backend
    2. That command can run on your dev machine
    3. You document all of the settings for your containers and deps 

Once you have that in a docker-compose.yml file migrating to something like kube when you need health checks, autoscaling, etc is easy.

The only thing you must be critical of is bashing people over the head to make everything you run in your company run in this environment you've created. No special deployments. Establish 1 method with 1 tool and go from there.

Every company I've worked at I've brought a single command `docker-compose up -d` workflow and people were amazed by the productivity gains. No more remembering ports (container_name.local.company.com), no more chasing down configuration files and examples, no more talking to shared DBs, etc.

Re:Do I Need Kubernetes? by save_ferris on Sunday August 16, 2020 @12:04PM (#24178859)
> people were amazed by the productivity gains

Yeah, docker compose is great for running distributed apps locally when everything “just works”. The problem is that it also impedes development when the compose setup isn’t fully optimized.

I work on dockerized rails apps, and whenever a new dependency is added, it can take 15 minutes to rebuild the image, which completely breaks my flow. Docker also creates a ton of data bloat locally, requiring me to run docker system prune pretty regularly. Setting up a dependency cache isn’t completely straightforward either.

I still think docker compose is worth it, but it’s a deceptively complex beast to get right, and most companies I’ve worked for don’t take the time to get it absolutely right. There’s definitely a cost to using it that people tend to overlook.

Re:Do I Need Kubernetes? by heroic on Sunday August 16, 2020 @02:31PM (#24180004)
Split the dockerfile into 3 parts. builder image for gems. builder image for assets(nodejs and stuff). copy code from disk, gems from image one, assets from image two, into the third image. you will end up saving HUGE time
Re:Do I Need Kubernetes? by timClicks on Sunday August 16, 2020 @06:30PM (#24181930)
Do you have an open source Dockerfile that demonstrates this pattern? I've used builder images before, but not multiple.
Re:Do I Need Kubernetes? by hadlock on Sunday August 16, 2020 @07:04PM (#24182137)
The relevant search term is "base image"

Just remember to have a process to rebuild your base image at least once a month so you pick up latest security fixes etc.

Re:Do I Need Kubernetes? by shaklee3 on Sunday August 16, 2020 @09:59PM (#24183138)
Or search for multi-stage builds
Re:Do I Need Kubernetes? by save_ferris on Sunday August 16, 2020 @06:27PM (#24181913)
Thanks, I’m gonna try this.
Re:Do I Need Kubernetes? by tln on Sunday August 16, 2020 @02:24PM (#24179973)
First, make sure you only copy your Gemfile and maybe Gemfile.lock before running bundle install. If you aren't that could explain the amount of bloat since every build will create some large layers with no chance of re-use.

You could try making your own base image that installs your gems. Eg, copy your Dockerfile to Dockerfile.base. Remove everything after the bundle install, and build to say app-base:latest.

Then change the FROM in your Dockerfile to app-base, and remove any OS package installs. Keep the bundle install; it will use the layer from app-base if unchanged, or do an incremental install if not.

This will reduce the amount of data bloat too.

You could try using guard-bundler or something similar to further streamline the process when adding gems

Re:Do I Need Kubernetes? by onei on Sunday August 16, 2020 @03:06PM (#24180293)
I'd suggest using targets within the dockerfile combined with buildkit. Targets allow you to build multiple images from one dockerfile or have multiple distinct stages that depend on one another. Using buildkit means you can build target dependencies in parallel.

Personally, I found having multiple intermediate dockerfiles more confusing than helpful, so having an easy to follow, centralised build made life a lot easier for me, especially if you produce multiple images that are pretty similar at the base.

Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @12:27PM (#24179061)
At my current company, since I'm using gRPC, the build contexts for my containers are annoyingly large and I'm definitely feeling this. It's a massive pain and really annoys me but If I had to choose between 40 minutes of stressful debugging of someone else's config files vs 40 minutes of waiting for a command to finish, I'd take the latter.

Long term I'm planning on moving these builds to bazel and taking advantage of incremental builds for my entire monorepo. I'm in the final stages and just validating some stuff is in place before I do that. In the short term I've mitigated this by adding in heavy unit test coverage. Backend devs can basically run the unit tests for most services and are confident the service is working as expected and also enforces any/all security/auth checks. When developing I don't even start up the containers. I boot them up once at the end just to check my work.

Re:Do I Need Kubernetes? by austinpena on Sunday August 16, 2020 @09:24PM (#24182913)
Why not just have a shared volume for your dependencies? That way nothing needs to rebuild.

Then just have a different Docker-compose config for prod

Re:Do I Need Kubernetes? by gravypod on Monday August 17, 2020 @12:46AM (#24184073)
The main reasons are:

    1. My applications have no dynamic "linking"
    2. The containers are distroless
    3. Services can be built independently
    4. I run the same exact sha in dev/staging/prod
To do what you're suggesting would require giving up one of my features which for me is not worth the trade off of a one-time setup 40min build of 20+ services (~2min/service). The last time I paid that 40min cost was ~2 months ago when I reformatted my hard drive.

The better solution for me is looking into a build system that can support my different language and tooling choices which happens to be things like Blaze (Bazel/Pants/Buck/Please).

Re:Do I Need Kubernetes? by ahmedfromtunis on Sunday August 16, 2020 @04:07PM (#24180784)
If I understood correctly, this means that every time you add a new dependency, it takes 15 minutes to rebuild the first time you `docker-compose up` right?

I assume this is due to docker downloading the related image and running the container.

If this is the case, isn't this orders of magnitude faster than adding the dependency manually. And aren't the gains are even more significant when we factor the fact that most of the cases dev and prod environments are identical? Or am I missing something?

Re:Do I Need Kubernetes? by save_ferris on Sunday August 16, 2020 @06:27PM (#24181908)
> this means that every time you add a new dependency, it takes 15 minutes to rebuild the first time you `docker-compose up` right?

Yes

> If this is the case, isn't this orders of magnitude faster than adding the dependency manually.

No. When developing a rails server running locally, you just need to install the new dependency via bundle install (usually takes just a few seconds) and then your server is ready to run again. With docker, the image needs to be entirely rebuilt, which is a much slower process, even with good caching. The difference is that docker treats the build as ephemeral and willing to be thrown away and rebuilt, as opposed to running directly, which simply augments the existing environment. It’s a much, much slower process to rebuild via docker.

Re:Do I Need Kubernetes? by ClikeX on Monday August 17, 2020 @03:38AM (#24184922)
Adding Ruby dependencies (gems) is pretty trivial. And the Ruby package manager (bundler) only installs the new dependency if you do it on your own machine. In Docker it will do all of them.

It's worth noting that bundle uses a Gemfile, so it's not installing each Gem as a seperate step.

Re:Do I Need Kubernetes? by the8472 on Sunday August 16, 2020 @06:33PM (#24181940)
You can also skip the docker rebuild and map in the build directory from your host system as bind volume instead.
Re:Do I Need Kubernetes? by dugmartin on Sunday August 16, 2020 @11:14PM (#24183508)
At work we use docker-compose for legacy Rails (3!) development (we deploy on AWS ECS using Cloudformation templates).

I wasn’t involved in the setup but adding a new gem or upgrading one is very quick. We use a mounted volume to hold the gems as seen here: https://github.com/concord-consortium/rigse/blob/master/rail...

Re:Do I Need Kubernetes? by abatilo on Sunday August 16, 2020 @01:18PM (#24179455)
There are a lot of projects these days that aim to use Kubernetes as a docker-compose environment. I personally use http://skaffold.dev/ with either a local Kubernetes cluster built with https://github.com/rancher/k3d or https://github.com/kubernetes-sigs/kind. I think there's a very easy argument to be made that says that running K8s locally is overkill, but what I will say is that if you run your applications locally in K8s, that's one step closer to having your local environment mirror the production environment. Couple that with things like running https://github.com/localstack/localstack locally and you get even closer.
Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @02:37PM (#24180045)
`kind` and `k3d` are great but I don't think their aimed at being a developer friendly cluster from what I understand. They both require a lot of tweaking and setup to make them look like their a managed kube cluster (LB, storage, ingresses, etc). I wish there was something that could create a kube cluster that:

    1. sets up automatic port forwards to my host system
    2. handles ingresses by binding port :80 on my system
    3. provisions PVs for you when you create PVCs and respects retention policies 
    4. Allows you to select from a monitoring stack and only require that you supply configurations for dashboards/alerts that can be 1:1 applicable to production so devs can debug dashboards/alerts locally. 
`kind` is targeting itself as being "a real kubernetes implementation"

`k3d` is targeting itself as being Rancher's kubernetes implementation so if you buy into all of the Rancher tooling it'd be a great option.

Re:Do I Need Kubernetes? by MichaelMoser123 on Sunday August 16, 2020 @08:55PM (#24182743)
I have a script that simplifies creation of kind clusters with local registry and ingress https://github.com/MoserMichael/kind-helper (to make it more developer friendly that is) but i guess kind is more for automation testing purposes as it runs all modes in docker containers on the same machine.
Re:Do I Need Kubernetes? by gravypod on Monday August 17, 2020 @12:22AM (#24183938)
Looks like a nice tool. If it could watch for changes, rebuild, repush, and restart pods it would be the perfect dev environment. Even still this looks like a great start. Have you thought about polishing it a little more and doing a Show HN?
Re:Do I Need Kubernetes? by MichaelMoser123 on Monday August 17, 2020 @12:48AM (#24184088)
Thanks, i think that building images and restarting pods would be a bit out of scope for this script, but you have examples in the tests for this project. For kubernetes cluster administration i have this project; https://github.com/MoserMichael/s9k
Re:Do I Need Kubernetes? by watermelon0 on Sunday August 16, 2020 @04:18PM (#24180890)
Neither k3d (k3s) nor kind support building of images since they use containerd directly, which [building] seems to be a requirement for development environment.

This means that you need to build your app using Docker, and then import it to k3d/kind environment, thus needing local registry (not enabled by default), which means that images are duplicated.

Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @05:07PM (#24181318)
Yea, exactly, this. I see all sorts of people making build systems and tools and they say you just do "my_command build my_target && docker-compose up -d" and I can't help but wonder: are these people ONLY developing 1 service? For me, that would be multiplied by 20x and we're not even at the number of services we're expecting.

We do a lot of integration with third parties which is essentially pull down some data and write it into a microservice responsible for keeping that data. Each of these integrations is owned by a separate engineer because it takes up a lot of time to deal with integration calls, planning, etc and we need to be language flexible (some people only give you a .dll or .jar, no choices).

I'm assuming people building these tools don't use a local development workflow because: their systems are too big to run on a single machine (Googlers) or don't work on large projects (open source side projects).

The clostest thing to what you and I are looking for, though, is skaffold and tilt.dev.

Re:Do I Need Kubernetes? by oldman_peter on Tuesday August 18, 2020 @05:45AM (#24196838)
I use a `buildah` to build images in a k3s container. You'll have to enable user_namespace at boottime on your k3s host though.
Re:Do I Need Kubernetes? by moondev on Monday August 17, 2020 @07:32AM (#24186208)
Have you tried building images from inside a pod via buildah?
Re:Do I Need Kubernetes? by tilolebo on Sunday August 16, 2020 @02:58PM (#24180227)
Talking about kind and k3s, does anyone know how to load a local docker image into a k3d cluster?

The command is supposed to be: 'k3d image import --cluster myCluster image:tag', but it fails with "Failed to start exec process in node 'k3d-myCluster-tools'"

On kind it works fine with 'kind load docker-image --name myCluster image:tag'.

I'm using WSL2.

Re:Do I Need Kubernetes? by MichaelMoser123 on Sunday August 16, 2020 @09:15PM (#24182855)
You might take a look at my script https://github.com/MoserMichael/kind-helper , sets up local regustry with kind so you can do without image import. (Comes with test case/example))
Re:Do I Need Kubernetes? by JamesSwift on Sunday August 16, 2020 @12:20PM (#24179002)
I prefer to take it one abstraction further and setup a makefile where the default `make` brings up the app. This makes it so you can rework the runtime as you see fit and nothing changes. It also doesn't require you to jump into docker immediately, and gives a good extension point for various 'helper script' workflows that you will always have.
Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @12:31PM (#24179100)
Makefiles are nice in theory but don't scale well to team members who don't know how to use make. If your team is full of experienced C/C++ devs then this will probably work great for you. If you are working with a bunch of android/javascript/etc developers who've never seen make, and who haven't exercised the skillset of reading through 3-decade-old email threads to find answers, you'll find that the only thing you'll do is "make" them upset.
Re:Do I Need Kubernetes? by ezekiel68 on Sunday August 16, 2020 @03:15PM (#24180374)
Not to pile on -- and I'm sure there would be exceptions -- but I've worked with some large and dynamic (employee churn) dev teams and it's always been worth it in my cases, so far, to burn a half day with new people to get them comfortable with Makefiles (and how to fix the common errors when editing them). Teams I've been on have used them for python, ruby, node, Java and Rust[1] codebases (across the years). It's definitely language-agnostic enough on its own. Oh! And the same Makefile is used in the CI/CD pipeline, to make the entire process more likely to be repeatable by our automation tools.

[1] Yes, our Makefiles sometimes call docker/npm/ant/maven/gradle/cargo under the hood. Its been worth it, in my experience. One syntax on all projects to set up the workspace, refresh dependencies, deploy to dev env, clean, etc.

Re:Do I Need Kubernetes? by nthj on Sunday August 16, 2020 @01:17PM (#24179443)
C. S. Lewis taught me newness is no virtue, and oldness is no vice. I’ll leave the answer as to why I’m quoting a writer on religion in response to an anecdote on developers’ quirks about their environment as an exercise to the reader.
Re:Do I Need Kubernetes? by JamesSwift on Sunday August 16, 2020 @12:44PM (#24179206)
Dont these issues also apply to the docker-compose alternative? I'm recommending make as "the one tool" to use for all of your teams apps. No matter what app they work on, everything is setup with `make bootstrap` and everything is run with `make up`. Everything is deployed with `make deploy`. They dont need to understand the _how_, only the _what_.
Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @02:23PM (#24179967)
No, other tools do not suffer from what makes make complex. Make is "hard" because of a few things:

    1. The syntax is very complex
    2. It's just a wrapper around shell command execution
    3. There's no single standard everyone fully implements
If I implemented a makefile then I'd have to make sure it's compatible with MacOS and GNU Make. The syntax for make files and target deps are also very complex "Do I want to use % or $ or @?" Make also implements very few pieces of functionality. It forks out SHELL for most things and because of this you need to have everything your makefile is using installed on your system. If you have a makefile, invariably, someone implements some tool that's super helpful and works.... until it doesn't. It depends on some system configuration or utility that is no longer a dep of something you've manually installed and the makefile breaks. If you use containers for all of your functionality this is no longer an issue because you can vendor base layers of OSs/images and make sure they don't break. You can also test these changes, that could be breaking, without rolling out to other developers. I cannot test if my Makefile will run on a developer's mac if I don't have a mac myself and even then it's a crap shoot (do they have homebrew? is their PATH correct? etc).
Re:Do I Need Kubernetes? by patrick451 on Sunday August 16, 2020 @04:12PM (#24180833)
> The syntax for make files and target deps are also very complex "Do I want to use % or $ or @?"

How is this any more complex than any programming language? Take javascript. Do I want to use =, ==, or ===?

> I cannot test if my Makefile will run on a developer's mac if I don't have a mac myself and even then it's a crap shoot (do they have homebrew? is their PATH correct? etc).

Containers suffer from these kinds of problems as well. For example, if your ip tables are not set up just so, you get no network access from inside your container.

Re:Do I Need Kubernetes? by thiht on Sunday August 16, 2020 @01:38PM (#24179608)
> Makefiles are nice in theory but don't scale well to team members who don't know how to use make

Just learn it then? Running make commands is trivial. Writing basic make targets is trivial too.

Re:Do I Need Kubernetes? by pc86 on Sunday August 16, 2020 @04:45PM (#24181149)
Well the entire linked article and this entire thread (and all the others) could be boiled down to "Just learn [kubernetes,docker,whatever] then?" but that's not super helpful.
Re:Do I Need Kubernetes? by spanhandler on Sunday August 16, 2020 @01:29PM (#24179542)
Yeah but if you use bare tools then it’s hard to change them and the interface may differ project to project. If you let the JS developers pick your universal build tool then they’ll want to change it annually because now the old one they loved is “terrible” and some other thing is great and is definitely the way forward. Plus then you’ll need node on every machine that needs to run the build, and probably you’ll want to lock the version and not use the one in LTS OS releases because those are too old so now all your poor non-JS developers are installing NVM and Node and a pile of other crap.

Or you can just make everyone wrap their build tools in make.

Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @02:27PM (#24179983)
The solution here is to choose a build system that is language agnostic. The most common of these is docker & docker-compose. There's also the Blaze-likes (Pants, Buck, Bazel, Please) that let you hermetically include tools like node inside of the build chain.

Make is not a "wrapper" it's a "translucent layer on top of" since it doesn't hide the deps on the underlying tools.

When I do `docker build -t ... something` or `bazel build //something` I don't need to care if it's node, C++, Java, etc. I just need to know that it is a thing that I want to build. Make cannot deliver that to you as you need all of your system toolchains installed and you need to make sure your makefile works on every OS/system config.

Re:Do I Need Kubernetes? by solraph on Sunday August 16, 2020 @09:50PM (#24183089)
> Make is not a "wrapper" it's a "translucent layer on top of" since it doesn't hide the deps on the underlying tools.

For me, that's kinda the point. If (when!) the underlying layers break, I can open up the Makefile and see exactly what was called, without too much abstraction. It's not there to provide complex build options, it's to provide aliases to the commonly used commands in a platform agnostic way.

Most of my make commands are simply aliases for one or more commands, which are often something like `docker run --rm -it project_runner_image some_command`

There's some real problems with Makefiles in the form of tabs as the prefix, running everything as a shell, weird platform specific versions, etc - but I've yet to see anything else which is as small, as universally available, with such a low barrier to entry. Most of the other options I've seen so far (and I'll be the first to admit I haven't looked very hard) seemed to either be overly complex for simple dev setups, or bound to a particular language.

Re:Do I Need Kubernetes? by JamesSwift on Monday August 17, 2020 @09:26AM (#24186986)
Yes, you still have to make sure the underlying commands work because Make doesnt provide anything to isolate the commands. But that is also sort of my point: make is nothing but a generic task runner on top of what you are already doing. Its just about having commands and conventions that dont change depending on the underlying systems.

I agree that blaze is the better option, but all the benefits it provides comes with a greater up-front cost, where its not necessarily possible to drop-in on a project and run with. Also notable is that blaze is inspired by and is a replacement for make. So in a lot of ways, make is a poor mans blaze now.

Re:Do I Need Kubernetes? by inshadows on Monday August 17, 2020 @05:31AM (#24185531)
> If you are working with a bunch of android/javascript/etc developers who've never seen make, and who haven't exercised the skillset of reading through 3-decade-old email threads to find answers, you'll find that the only thing you'll do is "make" them upset.

Actually I find most answers either in official documentation or on StackExchange sites. And I much prefer digging in mailing lists over digging in GitHub issues. You access both over web anyway.

Re:Do I Need Kubernetes? by pc86 on Sunday August 16, 2020 @04:34PM (#24181062)
I would love to see an example of how to set something like this up if you've got any links in mind.

We've got multiple apps deployed various ways, everything from pseudo-automated CI/CD (auto build but manual deploy) to fully manual deployment directly out of our IDE. Nothing set up within Docker containers yet except for a few proofs of concept.

Re:Do I Need Kubernetes? by halbritt on Sunday August 16, 2020 @01:31PM (#24179553)
This facilitates a benefit that I think has been described as "self-contained systems". There's one website on the topic, that imho is too narrowly focused and seeks to distinguish itself from microservices incorrectly, I think.

That said, a self-contained system in the context of a container orchestration framework, docker-compose, kubernetes, etc, facilitates an number of benefits, not the least of which is the ease of scaling engineering staff.

For example, in typical organizations that claim to have modern development practices, there are static dev, test, and staging environments for a given service. Obviously these are subject to config skew, etc. and must be time-shared between folks. When it's a simple task to create an environment per engineer for each purpose or any other, that can accelerate development tremendously.

There are other benefits around resilience in production, but that's another topic entirely.

Re:Do I Need Kubernetes? by weedpeg on Sunday August 16, 2020 @01:28PM (#24179526)
Agreed with all mentioned upsides of dockerzing apps. One disadvantage though is a lot of additional work is required for APM/logs/infra monitoring. Even in 2020, newrelic/datadog/others documentation seems to be written non-containerised setup.
Re:Do I Need Kubernetes? by JaggedNZ on Sunday August 16, 2020 @10:48PM (#24183403)
Anyone encountered issues running a docker-compose stack of 5+ containers mostly RoRails apps incl. Postgres on Mac Catalina?

Most of the issues seem to be with Postgres DB connections, but it makes starting up our backend painfully slow...

Re:Do I Need Kubernetes? by mattacular on Sunday August 16, 2020 @11:11PM (#24183490)
Docker is slow on Mac. Especially with volumes. This is one drawback to dev'ing everything with Docker locally. If you need to coordinate lots of services across containers to establish the local environment though this is probably something you can live with compared to the alternatives.

Edit: Some tuning options also exist - https://docs.docker.com/docker-for-mac/osxfs-caching/

Re:Do I Need Kubernetes? by thom on Sunday August 16, 2020 @12:01PM (#24178833)
Can I ask people who _don't_ use Kubernetes and maybe have architectures built on proprietary cloud services: how do you manage this?
Re:Do I Need Kubernetes? by tootie on Sunday August 16, 2020 @04:58PM (#24181241)
Ask every enterprise that existed prior to 2018? Even for small and mid-size enterprises, manual deploys aren't that huge of a deal. Automation with some bash scripts can get you pretty far. Especially if you're only managing a monolith or two. I've worked in some platforms that absolutely defied automation due to their proprietary nature. It just meant that we'd need a few people to spend 1-2 hours every two weeks to run a deployment. That cost added up over even a year or two is probably less than paying for a redesign and replatform.

I've also done deploys just using managed services like ECS/Fargate or Heroku where we just build an artifact and push it to the host with a script. A stack that's a load balancer, stateless app server then a DB and/or file store can be provisioned manually once then not really worried about for a long time.

Re:Do I Need Kubernetes? by thom on Sunday August 16, 2020 @06:46PM (#24182031)
To be clear, I was more asking how people achieve the sort of fast bootstrapped dev environments the parent comment describes using k8s, especially where you’re not necessarily talking about simple topologies like a monolith plus a database.
Re:Do I Need Kubernetes? by peterwwillis on Tuesday August 18, 2020 @10:45AM (#24199208)
Option 1: Everyone develops on the CI/CD platform.

Ops gives devs "disposable environments" to do their testing in. Basically, GitHub + Jenkins + Terraform + AWS. I've used this to stand up real infrastructure every time a PR is opened, and pipelines run against the infra. Code and infra match each other because they both exist in the same branch/repo (monorepo; you can of course do multi-repo, just takes more coordination). It's all destroyed as soon as the PR is closed, but you can also keep it up to do dev work against. You can also keep one copy of the latest master branch up at all times (the "dev" or "cert" or "test" infrastructure) as a shared test environment. Downside: you have to have access to the network (which is in AWS, so that's not so difficult). Upside: the dev environment always mimics production, devs don't need to do anything to stand it up.

Option 2: A bunch of mocks, and scripts to stand up stuff in Docker, using docker-compose or something else. This becomes a bit of a problem to manage with lots of devs, though, and docker-compose is not a good model for production deployments.

Re:Do I Need Kubernetes? by thom on Wednesday August 19, 2020 @09:27AM (#24210111)
Thank you for describing option 1, which is really what I was picturing but seemed ambitious enough that maybe nobody tried it.
Re:Do I Need Kubernetes? by AlphaSite on Monday August 17, 2020 @01:28AM (#24184296)
Tilt is pretty great for dev workflows on k8s, they have affordances for debuggers, fast restarts without a full docker build, docker push, k8s delete pod workflow.

https://tilt.dev

Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @12:18PM (#24178988)
Depends on what cloud services you use. I am very opposed to using any cloud service that I can't self host in some way or another. That's a sure fire way to end up screwed. The main cloud services I use at work are:

    1. S3/Azure Blob Store
    2. DocumentDB/CosmoDB/Cloud Atlas
    3. Aurora/A for PG DB
    4. ElastiCache/some complex name in azure
All of these data stores can be hosted locally using minio for s3, MongoDB for the mongo implementations, and postgres/mysql for the RDBMSs, redis/memcached for ElastiCache.

If there was ever a case that I needed to ever use a real - full vendor lockin - solution I would hide it behind an API of my own and configure that API to store data locally. For example, the Azure Blob Store local container is completely broken for any sensible usage and I've been on an github issue thread for ~3 months waiting for them to resolve the issue (you're forced to link your netns to that container to talk to it as the application clients only works over 127.0.0.1). So essentially I have the following settings:

    - SERVICE_STORAGE_DRIVER=azure/fs
    - SERVICE_FS_LOCATION=/data
    - SERVICE_AZURE_CONTAINER=....
    - SERVICE_AZURE_....=....
So in development it runs in fs mode, in prod it runs in azure mode, you mock the azure blob client in unit test to make sure that code works.
Re:Do I Need Kubernetes? by RaitoBezarius on Sunday August 16, 2020 @12:22PM (#24179027)
Immutable infrastructure using Nix/NixOS.
Re:Do I Need Kubernetes? by lallysingh on Sunday August 16, 2020 @07:05PM (#24182149)
I have used this. It has its benefits but you have to be ready to walk into alpha-ville (alpha-quality stuff) and take the pain that comes with it.

NixOS, however, I will not recommend as your dev environment. Use a regular distro and use NixOS for your containers.

Re:Do I Need Kubernetes? by IggleSniggle on Sunday August 16, 2020 @12:19PM (#24178996)
Baroque organically grown scripts of arcana.
Re:Do I Need Kubernetes? by pc86 on Sunday August 16, 2020 @04:46PM (#24181160)
This is the correct answer for 99% of brownfield projects, especially those that didn't begin life on a cloud provider.
Re:Do I Need Kubernetes? by what-the-grump on Sunday August 16, 2020 @10:39PM (#24183350)
Define the same scripted startup on whatever floats you boat and run it.

We used to be able clone 400 VMs in 1 hour, sanitize all customer data and refresh a full dev environment from m prod in an hour. TBs of data.

But let's all stand around and claim k8s is not your flavor of the day solution to a very old problem, but one that caries a huge amount of complexity and so much network effry that it scares the pants off most people.

Re:Do I Need Kubernetes? by brian_herman on Sunday August 16, 2020 @12:32PM (#24179114)
I use a git repo and pull in the changes to an ec2 instance. We also use git repos for our lambda functions.
Re:Do I Need Kubernetes? by brian_herman on Sunday August 16, 2020 @12:33PM (#24179118)
Also our lambda functions are managed by bash scripts we created to interact with aws cli.
Re:Do I Need Kubernetes? by drran on Sunday August 16, 2020 @04:44PM (#24181146)
Everything is packages in RPM, so simple dnf install on bare metal or in container is enough.
Re:Do I Need Kubernetes? by daralthus on Sunday August 16, 2020 @03:17PM (#24180391)
Use Pulumi or Terraform.
Re:Do I Need Kubernetes? by akritrime on Monday August 17, 2020 @12:27AM (#24183988)
How do you make sure it is available on container_name.local.company.com whenever a new container is added?
Re:Do I Need Kubernetes? by gravypod on Monday August 17, 2020 @06:59PM (#24193279)
You can setup wildcard DNS names or use `{STAR}.{localhost,local}` for local development. Just use a reverse proxy on `:80` that allows you to define wildcard subdomains like `container_name.{STAR}` or setup the reverse proxy to automatically take the subdomain and use that as the backend server name (should be possible in nginx).

HN uses * for formatting so it's been replaced with {STAR}

Re:Do I Need Kubernetes? by ravedave5 on Sunday August 16, 2020 @09:33PM (#24182983)
How do you develop/IDE/debug apps like this though?
Re:Do I Need Kubernetes? by gravypod on Sunday August 16, 2020 @11:27PM (#24183589)
Multiple approaches I've seen in the past. My most recent approach is to rely heavily on unit tests and do 99% of your testing there. Before opening a PR/MR/CL into `master` I test my feature out end-to-end using `docker-compose up --build service_name` and make API calls or use the UI to test everything. Code coverage keeps my confident that everything works, my tests automatically run on all other engineer's machines, I can test the code in a very-close-to-prod environment, life is good.

Another approach, from a previous startup, who mainly/only used PHP was to volume mount the code you were editing into the containers that were running and to expose an xdebug port for our IDEs to connect to. This was very hacky and error prone but when it worked it worked.

Something that I plan to do in the future is to setup some incremental build system that can build all of my software and use that to build my containers. Whenever these outputs change I'll have them redeploy the container in docker-compose or minikube. This way I get very fast builds, very small containers, and much fewer hacks.

Re:Do I Need Kubernetes? by dajohnson89 on Sunday August 16, 2020 @05:17PM (#24181412)
is there a performance hit with using databases inside docker?
Re:Do I Need Kubernetes? by lazyant on Sunday August 16, 2020 @06:08PM (#24181781)
yes, but due to docker networking overhead (supposing you are using a volume on the host, as you should).