geerlingguy / kubernetes-101

Kubernetes 101 - by Jeff Geerling
https://kube101.jeffgeerling.com/
MIT License
555 stars 166 forks source link

Topic missing from all K8s #41

Closed frob closed 1 year ago

frob commented 2 years ago

How does one use K8s for development? There are many other tools that have been launched to try and solve this problem but they only seem to hide how the sausage it made. I am referring to tools such as: lando, ddev, lagoon, and others.

What I need is someone to publish a guide on how to use K8s as a developer of a Drupal site.

geerlingguy commented 2 years ago

Thanks for the issue; I would not recommend using k8s to develop a site; instead you could use a local development tool, or build something using k3s or more likely minikube or something similar that's geared towards local development.

But even there, running Drupal in a local development environment is going to be a lot nicer since Kubernetes is not really built for local dev work.

frob commented 2 years ago

That really is the question; how does one develop a complicated site when hosting is being done on kubernetes. Back when everything was VMs it was easy to know the environment of final hosting matched that of the development environment because we could use (mostly) the same ansible scripts to build the local VM as the machine that would be hosting. This is a really confusing topic. I was hoping to peak your interest enough to want to tackle it but I understand you've been involved in more interesting things. The best thing I have found for local development is docker compose but that isn't how we will be deploying anything.

geerlingguy commented 2 years ago

The key would be to make sure the internal container structure is set up to be reproducible in prod and local (and other environments). And there's always a grade to how much you need each environment to match.

For some applications, getting a proxy layer (Varnish/Nginx, Ingress structure, etc.) is all important to how it runs, so you have to get all that working locally—which can be tough depending on what kind of computers and local access developers get.

For many, just having a reproducible database and application (PHP+Apache, or PHP-FPM+Nginx) container setup could be enough where you could deploy that inside k3s locally, and whatever kubernetes setup you have running in prod. Some people use Helm for that, some people Ansible, some people shell scripts...

And I know some people use some tooling to convert a docker-compose.yml file (that they use local) into K8s deployments (that they push to the server), though that seems a lot more fragile and prone to headaches.

One of the hardest bits for local dev (besides ingress, which can be a pain) is the sharing of the local Drupal files to your local IDE/dev tooling. Some people use some sort of shared volume plus a special mount that's only run in the dev k3s environment. Some people use a form of SSH to reverse mount it from the container to their computer... that can be kinda complex too. Or it could be an NFS volume mounted into the container, and that's usually easiest on Linux but can be done on Windows or Mac too.

stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 1 year ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.