From 123e744933952675b5b2024afdbd0289fb1425e0 Mon Sep 17 00:00:00 2001 From: Nathan Shaw Date: Wed, 9 Aug 2023 16:33:25 -0400 Subject: [PATCH 1/2] ENDOC-734 Docker Desktop blog post --- ...-09-install-entando-with-docker-desktop.md | 107 ++++++++++++++++++ .../docs/_posts/images/2023-08-09-docker.png | Bin 0 -> 4088 bytes 2 files changed, 107 insertions(+) create mode 100644 vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md create mode 100644 vuepress/docs/_posts/images/2023-08-09-docker.png diff --git a/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md b/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md new file mode 100644 index 0000000000..4b66c33915 --- /dev/null +++ b/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md @@ -0,0 +1,107 @@ +--- +author: Nathan Shaw +date: 2023-08-09 +title: "Installing Entando for local development using Docker Desktop" +summary: Setting up a local development environment and optimizing it for daily use is a critical task. Although most development tasks for Entando-compatible components do not require a local Entando instance, there are times when you want to test a new bundle and do not have a full remote cluster available. This blog post explores setting up a small cluster in Docker Desktop for this purpose. +tags: +- Local Development +- Docker Desktop +- Install +- Entando 7.2 +cover: /images/covers/2023-08-09-docker.png +--- +Setting up a local development environment and optimizing it for daily use is a critical task. Although most development tasks for Entando-compatible components do not require a local Entando instance, there are times when you want to test a new bundle and do not have a full remote cluster available. This blog post explores setting up a small cluster in [Docker Desktop](https://www.docker.com/products/docker-desktop/) for this purpose. + +There are numerous options available when setting up a local development environment using Kubernetes. Entando's [Getting Started Guide](../v7.2/docs/getting-started/README.md) makes use of [Multipass](https://multipass.run/) for this purpose but this approach isn't always possible, say in some enterprise environments where Docker Desktop is allowed but direct use of Windows Subsystem for Linux is not. In this situation, enabling Kubernetes in Docker Desktop can be the simplest path forward. + +>*Note:* The following steps were tested on Windows 11 with Docker Desktop (current at the time)including K8s 1.24. + +# Enable Kubernetes in Docker Desktop +1. Start by enabling [Kubernetes in Docker Desktop](https://docs.docker.com/desktop/kubernetes/). In most cases this just involves enabling the option in the Docker Desktop UI and restarting Docker Desktop but there are some edge cases noted in the documentation. + +>*Optional:* For local development, connecting the entando CLI to your local cluster can be very useful. That can be done by [creating or selecting your ent profile](../v7.2/docs/getting-started/entando-cli.md) and then connecting your profile to the Kubernetes context using `ent profile link docker-desktop`. The following commands will reference `kubectl` but as always this can be replaced by `ent kubectl` or the shorter `ent k`. + +2. Check that Kubernetes is up and running: +``` bash +kubectl get node +``` + +>*Tip:* You can use [the standard Docker tutorial](https://www.docker.com/blog/how-kubernetes-works-under-the-hood-with-docker-desktop/) to setup a quick `LoadBalancer` and sample `Deployment`. Installing those resources in a dedicated namespace can make removing the resources later a simpler task. + +# Install the NGINX Ingress Controller +Entando uses a small set of paths for the different services in an Entando Application so we'll need to install an ingress controller. We'll use the NGINX version since it is used in most of the [Entando install guides](../v7.2/tutorials/README.md) + +1. Enable the NGINX ingress controller [following the steps here](https://kubernetes.github.io/ingress-nginx/deploy/#docker-desktop): +``` bash +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml +``` + +2. Access an arbitrary URL against localhost and you should now see an NGINX 404 error, for example `http://localhost/some-path`. + +# Install Entando +Many of the following steps are identical to those in the [Getting Started guide](../v7.2/docs/getting-started/README.md) so see that page for explanatory details. +> *Note:* Make sure to check for the correct Entando patch version for the install steps since this blog post specifically documents the steps for Entando 7.2.2. + +1. Create the namespace: +``` bash +kubectl create namespace entando +``` + +2. Download the operator config map template: +``` bash +curl -sLO "https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/samples/entando-operator-config.yaml" +``` + +3. Edit the file to select the NGINX ingress controller: +``` yaml +data: + entando.ingress.class: "nginx" +``` + +4. Create the operator `ConfigMap`: +``` bash +kubectl apply -f entando-operator-config.yaml -n entando +``` + +5. Add the cluster resources: +``` bash +kubectl apply -f https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/namespace-scoped-deployment/cluster-resources.yaml +``` + +6. Add the namespace resources: +``` bash +kubectl apply -n entando -f https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/namespace-scoped-deployment/namespace-resources.yaml +``` + +7. Determine your IP address (YOUR-IP) using `hostname -I | awk '{print $1}'` or by visiting `https://whatismyip.com`. + +8. Download the Entando Application template +``` bash +curl -sLO "https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/samples/entando-app.yaml" +``` + +9. Edit the template and set the ingressHostName to `entando.YOUR-IP.nip.io` or another address that will route to your local machine. +> *Note:* Some connections from one pod to another will use a public address, rather than a cluster-level address. If the component manager and de-app deployments fail to start correctly, this is the most likely cause. See the [tips and tricks page](../v7.2/docs/reference/local-tips-and-tricks.md) for troubleshooting tips. In my testing I realized my router had recently upgraded and was blocking all port forwarding so I had to re-enable that setting. + +10. Create the Entando Application resource which will start the installation process: +``` bash +kubectl apply -f entando-app.yaml -n entando +``` + +11. After 10 minutes or so, confirm your application is working. See the [Getting Started guide](../v7.2/docs/getting-started/README.md#next-steps) for additional next steps. + +# Observations +I can see a few pros and cons for this configuration: + +*Pros* +* Docker Desktop has broad adoption so making use of its built-in support for Kubernetes can be very straightforward +* Networking is a typical challenge for local Kubernetes environments but I didn't observe anything more difficult with this setup +* You can easily turn off Kubernetes (and come back to it later) by disabling the option in Docker Desktop + +*Cons* +* I didn't do a thorough comparison but anecdotally Docker Desktop with Kubernetes consumes more resources, CPU and memory, than Entando's Multipass-based approach due to the overhead of Docker Desktop itself. +* At least on Windows, the Multipass setup works seamlessly with Windows networking by automatically provisioning an `entando.mshome.net` address and mapping it to the Multipass VM. That can be a better experience, and often simpler from a network standpoint, then using an `.nip.io` address. +* Since Multipass directly uses a single container, it's easier to take and restore snapshots of test instances there. + +# Next Steps +It would be interesting to do a similar investigation using [Minikube](https://minikube.sigs.k8s.io/docs/), [kind](https://kind.sigs.k8s.io/), or [k3d](https://k3d.io/). There are numerous write ups in the broader community (e.g., [https://linuxconcept.com/comparing-minikube-kind-and-k3d] ) comparing resource usage, production-like qualities, and developer friendliness, but a review from an Entando perspective has not been done in a while. [Community](../v7.2/docs/community/contributing.md) contributions would be welcome here! diff --git a/vuepress/docs/_posts/images/2023-08-09-docker.png b/vuepress/docs/_posts/images/2023-08-09-docker.png new file mode 100644 index 0000000000000000000000000000000000000000..831c5c6680b0d7a7628a12199e476078af20d654 GIT binary patch literal 4088 zcmV;R7J_4@t{lkFUo?J$|`3z6*c`Tkt3@NKg4?)Ltc$n`s(?yb@H=kfid&-TLH z_|)n9;qUx>yYso(_;a@Md%E+`=K99q`Jc@8jl%S=)c4uz`!${JN~G^ts_>7*^g^TW zQ}%(C000k1Nkl_ZP?F!) zb@%&FiUDzS*lY?>sf73HvTg6T;@#t3u{i)#Q`Y=f{{i2d%@J7qj|h5|p2;pjtBvqG zaOfp7;F`PMZ^&EiyWa>C?yQx&Ux^vHJKWCmkN+=YM(*y=zON?yjF^wRO5?GReO%xf z{wikUuFL2I(GpMbH!&M`d3Oi)mw1dniMhB7Xd7T9Zzjye-GkkLSFt${X5!9qxr^=V zGSBkYFq2;;1^oT+u*}2!F&uzMiaq3x`ZGC<)d7hmUyV0=#mnK}_B@{6W)lj(>~C>( zSu9?*A2GU-NHtzPEFXiSzhk0N3%jnjUlL_b;NXQirMNR$l}dP$ zy!UPIvSN4{r;yxxS62%!P>#wJ#O{Fke>Y_Ut9=IeORUoj^C5Cn8*Z|=d1e+juhdcY zW9@flSuFcLbr$%4Z6zRYa~VgC{X&WH0%Seqzvk}ewt0V31FR!=u>{4C8ZAk$#wZrOEbS*43@fGYstmiZ6#&UM`_!rgO7oyD!iY750U zo~ppD>uwS5`dXguA?N-${Y2bjs*g?iS(h+;2gFNmkz~GZ*15FyjtQ ziZ86|ZV~P_PlFAwYGqPTc3pSNaQD><3rc~kNrv9K?tZ|XB5tnZ&XHK>1K?>s`oGSd zP&D3f2g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}6w}V_jb;&>2;A3?V9$>^Rvxz2uP85q?S>z*^oG}m!CeqVi}}9{t0~uV>kbgAl-_Wz&Y3SO>j{o2(Z%0vtnr^yRB>2 zK3Oe;$g027aPzZu!Tl~c;W^*B7H&R_QIW`e>rFOC?cBAV{^&v7E8Ye#OwQRO_V3TV q+vNVcw`aM%YXg4J{K2K)n>LF-5gdG0j;0000 Date: Thu, 10 Aug 2023 14:23:33 -0400 Subject: [PATCH 2/2] ENDOC-734 Apply PR feedback --- ...-09-install-entando-with-docker-desktop.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md b/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md index 4b66c33915..65c52b6a86 100644 --- a/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md +++ b/vuepress/docs/_posts/2023-08-09-install-entando-with-docker-desktop.md @@ -12,14 +12,14 @@ cover: /images/covers/2023-08-09-docker.png --- Setting up a local development environment and optimizing it for daily use is a critical task. Although most development tasks for Entando-compatible components do not require a local Entando instance, there are times when you want to test a new bundle and do not have a full remote cluster available. This blog post explores setting up a small cluster in [Docker Desktop](https://www.docker.com/products/docker-desktop/) for this purpose. -There are numerous options available when setting up a local development environment using Kubernetes. Entando's [Getting Started Guide](../v7.2/docs/getting-started/README.md) makes use of [Multipass](https://multipass.run/) for this purpose but this approach isn't always possible, say in some enterprise environments where Docker Desktop is allowed but direct use of Windows Subsystem for Linux is not. In this situation, enabling Kubernetes in Docker Desktop can be the simplest path forward. +There are numerous options available when setting up a local development environment using Kubernetes. Entando's [Getting Started Guide](../v7.2/docs/getting-started/README.md) makes use of [Multipass](https://multipass.run/) for this purpose but this approach isn't always possible, for instance, in some enterprise environments where Docker Desktop is allowed but direct use of Windows Subsystem for Linux is not. In this situation, enabling Kubernetes in Docker Desktop can be the simplest path forward. ->*Note:* The following steps were tested on Windows 11 with Docker Desktop (current at the time)including K8s 1.24. +>*Note:* The following steps were tested on Windows 11 with Docker Desktop (current at the time), including K8s 1.24. # Enable Kubernetes in Docker Desktop 1. Start by enabling [Kubernetes in Docker Desktop](https://docs.docker.com/desktop/kubernetes/). In most cases this just involves enabling the option in the Docker Desktop UI and restarting Docker Desktop but there are some edge cases noted in the documentation. ->*Optional:* For local development, connecting the entando CLI to your local cluster can be very useful. That can be done by [creating or selecting your ent profile](../v7.2/docs/getting-started/entando-cli.md) and then connecting your profile to the Kubernetes context using `ent profile link docker-desktop`. The following commands will reference `kubectl` but as always this can be replaced by `ent kubectl` or the shorter `ent k`. +>*Optional:* For local development, connecting the Entando CLI to your local cluster can be very useful. That can be done by [creating or selecting your ent profile](../v7.2/docs/getting-started/entando-cli.md) and then connecting your profile to the Kubernetes context using `ent profile link docker-desktop`. The following commands will reference `kubectl`, but as always this can be replaced by `ent kubectl` or the shorter `ent k`. 2. Check that Kubernetes is up and running: ``` bash @@ -36,7 +36,7 @@ Entando uses a small set of paths for the different services in an Entando Appli kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml ``` -2. Access an arbitrary URL against localhost and you should now see an NGINX 404 error, for example `http://localhost/some-path`. +2. Access an arbitrary URL against localhost and you should now see an NGINX 404 error, for example, `http://localhost/some-path`. # Install Entando Many of the following steps are identical to those in the [Getting Started guide](../v7.2/docs/getting-started/README.md) so see that page for explanatory details. @@ -73,7 +73,7 @@ kubectl apply -f https://raw.githubusercontent.com/entando/entando-releases/v7.2 kubectl apply -n entando -f https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/namespace-scoped-deployment/namespace-resources.yaml ``` -7. Determine your IP address (YOUR-IP) using `hostname -I | awk '{print $1}'` or by visiting `https://whatismyip.com`. +7. Determine your IP address (YOUR-IP in step 9 below) using `hostname -I | awk '{print $1}'` or by visiting `https://whatismyip.com`. 8. Download the Entando Application template ``` bash @@ -81,7 +81,7 @@ curl -sLO "https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dis ``` 9. Edit the template and set the ingressHostName to `entando.YOUR-IP.nip.io` or another address that will route to your local machine. -> *Note:* Some connections from one pod to another will use a public address, rather than a cluster-level address. If the component manager and de-app deployments fail to start correctly, this is the most likely cause. See the [tips and tricks page](../v7.2/docs/reference/local-tips-and-tricks.md) for troubleshooting tips. In my testing I realized my router had recently upgraded and was blocking all port forwarding so I had to re-enable that setting. +> *Note:* Some connections from one pod to another will use a public address, rather than a cluster-level address. If the Component Manager and `entando-de-app` deployments fail to start correctly, this is the most likely cause. See the [tips and tricks page](../v7.2/docs/reference/local-tips-and-tricks.md) for troubleshooting tips. In my testing I realized my router had recently upgraded, blocking all port forwarding, so I had to re-enable that setting. 10. Create the Entando Application resource which will start the installation process: ``` bash @@ -94,12 +94,12 @@ kubectl apply -f entando-app.yaml -n entando I can see a few pros and cons for this configuration: *Pros* -* Docker Desktop has broad adoption so making use of its built-in support for Kubernetes can be very straightforward -* Networking is a typical challenge for local Kubernetes environments but I didn't observe anything more difficult with this setup -* You can easily turn off Kubernetes (and come back to it later) by disabling the option in Docker Desktop +* Docker Desktop has broad adoption so making use of its built-in support for Kubernetes can be very straightforward. +* Networking is a typical challenge for local Kubernetes environments but I didn't observe anything more difficult with this setup. +* You can easily turn off Kubernetes (and come back to it later) by disabling the option in Docker Desktop. *Cons* -* I didn't do a thorough comparison but anecdotally Docker Desktop with Kubernetes consumes more resources, CPU and memory, than Entando's Multipass-based approach due to the overhead of Docker Desktop itself. +* I didn't do a thorough comparison, but anecdotally Docker Desktop with Kubernetes consumes more resources, CPU and memory, than Entando's Multipass-based approach due to the overhead of Docker Desktop itself. * At least on Windows, the Multipass setup works seamlessly with Windows networking by automatically provisioning an `entando.mshome.net` address and mapping it to the Multipass VM. That can be a better experience, and often simpler from a network standpoint, then using an `.nip.io` address. * Since Multipass directly uses a single container, it's easier to take and restore snapshots of test instances there.