<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marc Enschede on Medium]]></title>
        <description><![CDATA[Stories by Marc Enschede on Medium]]></description>
        <link>https://medium.com/@marcenschede?source=rss-92de48d250a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*b2ptuCZkfrRNoWfO58WXQQ.png</url>
            <title>Stories by Marc Enschede on Medium</title>
            <link>https://medium.com/@marcenschede?source=rss-92de48d250a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:32:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marcenschede/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Waarom je Matter wilt]]></title>
            <link>https://marcenschede.medium.com/waarom-je-matter-wilt-17bc3165bd87?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/17bc3165bd87</guid>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Tue, 16 Jul 2024 11:51:58 GMT</pubDate>
            <atom:updated>2024-07-16T12:34:42.440Z</atom:updated>
            <content:encoded><![CDATA[<p>Domotica is here to stay. We bedienen steeds meer apparaten in onze huizen (en kantoren) met domotica. Wanneer je ‘s avonds thuiskomt, wil je met één druk op de knop alle verlichting, de verwarming en de radio in de juiste stand zetten. En zelfs wanneer je alle apparatuur apart wilt bedienen, doe je dat het liefst met één super afstandsbediening die je altijd bij je hebt: je telefoon. Voor wie dat overdreven vindt: denk eens aan de mogelijkheden om energie en geld te besparen door apparaten op het meest optimale tijdstip te laten starten.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*LVW4-m-BHEB9NEruLHlq_g.jpeg" /></figure><p>Oké, domotica komt er dus echt aan. Alleen is de vraag hoe we al die apparaten met je telefoon koppelen. Natuurlijk, een app voor je verlichting, een andere app voor je gordijnen, een derde app voor de verwarming, een voor de vaatwasser, enzovoort. Dat wordt ‘m dus niet. Los van de app-chaos op je telefoon is dan de vraag wie de choreografie over al die apparaten gaat doen; jij dus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEYRJr280udSkgQjEVm9ig.png" /></figure><p>Hoe dan wel? Eén ecosysteem waarop je al je apparaten kunt aansluiten. Apple wil die positie graag op alle Apple-apparaten, Google op de Android-apparaten en Amazon via Alexa. Samsung wil van hun TV die ene grote afstandsbediening maken en recent is ook LG toegetreden tot deze markt. Zij hebben een onafhankelijke speler in deze markt gekocht: het Enschedese Homey. Minimaal vijf partijen dus, en er zullen wel veel meer kleinere partijen zijn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxMSt8XWMa2Qjp4mIXUlhQ.jpeg" /></figure><p>Dan de apparaten. Er zijn inmiddels genoeg opties: de lampen van Philips Hue, de gordijnen van Ikea, de afstandsbediening van KlikAanKlikUit, de klimaatcontrole van Honeywell, de keukenapparatuur van Bosch, etc. Nog tientallen partijen zijn actief op deze markt, en er zullen nog veel meer bij komen. Denk aan acculaders die zelf het goedkoopste laadmoment kiezen, speakers die zelf kunnen streamen, ventilatoren in je kamer en nog veel meer. Deze markt wordt enorm.</p><p>Dat deze markt groeit, is leuk. Het levert alleen wel een uitdaging op. Hoe koppel je die ecosystemen aan al die apparaten? Hue is gekoppeld met Apple, Google en Amazon, Ikea ook.</p><p>Maar als jij nou een kleine leverancier van airco’s bent, zien die grote partijen je dan staan? Waarschijnlijk niet. Dan mag jij de integratie zelf regelen. Dat betekent dat je die minimaal met drie en waarschijnlijk veel meer ecosystemen moet integreren en ook moet onderhouden, want die ecosystemen zullen blijven innoveren. Stel dat er straks vijftien belangrijke ecosystemen komen en 20.000 apparaten. Dan moeten er 15 x 20.000 = 300.000 integraties onderhouden worden. Dat gaat dus niet gebeuren.</p><p>Matter to the rescue. Ja, want dat is precies het probleem dat Matter gaat oplossen: die koppeling. Noem Matter een taal die alle ecosystemen en alle apparaten kunnen spreken. Dan hoeven leveranciers van apparaten zich geen zorgen meer te maken over die ecosystemen. Ze hoeven alleen maar te zorgen dat hun apparaat Matter spreekt.</p><p>Oké, dan de vraag: gaat Matter het maken? Ja, ik denk het wel. Matter lost in ieder geval een groot probleem voor al die leveranciers van apparaten op. Zij zullen graag de overstap maken van eigen apps direct naar Matter, zonder de tussenstop van integratie met Apple, Google en al die andere partijen.</p><p>Dan zijn er natuurlijk ook de integraties die al bestaan, zoals met Hue, Ikea en al die anderen. Hoe lang zullen zij hun eigen integraties met al die verschillende ecosystemen nog willen onderhouden? Onderhoud kost geld, daar zullen ze op termijn vanaf willen.</p><p>De vraag is dus, wil jij Matter? Dat laat in natuurlijk helemaal aan jou over. Ik wil het in ieder geval wel. Ik wil niet het risico lopen dat pre-Matter apparatuur straks niet meer in mijn ecosysteem past. Ik wacht wel even met de aanschaf van handige apparaten tot ze Matter ondersteunen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17bc3165bd87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gaan de passwords nu echt verdwijnen?]]></title>
            <link>https://marcenschede.medium.com/gaan-het-password-nu-echt-verdwijnen-4016952b3544?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4016952b3544</guid>
            <category><![CDATA[webauthn]]></category>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[passwordless]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 20:53:22 GMT</pubDate>
            <atom:updated>2022-12-06T05:54:57.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HztEw6Pk1U21YcACUIs_4Q.png" /></figure><p>Passwords, we worden er gek van. Ze moeten steeds ingewikkelder, ze moeten om de paar maanden veranderen en niemand kan ze nog onthouden. En toch nog steeds zijn ze een welkome prooi voor fishing. Kan dat niet beter?</p><p>Ja, dat kan beter.</p><blockquote>Maar eerste, hoe werkt inloggen met een password? Een password is een zgn. ‘shared secret’. De gebruiker en de aanbieder van de dienst, bijv. een webwinkel of de site van de belastingdienst, delen een geheim. Het geheim is het password, beide kanten van de lijn kennen het geheime password. Wanneer een gebruiker inlogt wordt het password, hopelijk, encrypted naar de dienst verstuurd en daar vergeleken met het password dat daar, hopelijk, ook encrypted is opgeslagen. Maar wat als de site waarop we inloggen nu niet de site is die we verwachtten, wat als die site nu een namaak site die is opgezet door fishers. Dan belandt het wachtwoord van de gebruiker bij de fishers, die het op hun beurt weer kunnen gebruiken om op de site in te loggen. Of zelfs kunnen proberen om op andere sites in te loggen met de inloggegevens van de gebruiker. In dat laatste geval is er sprake van <em>credential stuffing</em>.</blockquote><blockquote>Zoals ik al zei, het kan beter. Het kan beter door gebruik te maken van een zgn. ‘public private keypair’. Door techneuten ook wel vaak afgekort tot ‘een private key’. Zo’n public private keypair bestaat uit 2 verschillende sleutels, een geheime en een niet-geheime sleutel. De 2 sleutels zijn wiskundig met elkaar verbonden. Wordt een bepaald getal met de niet-geheime sleutel gecodeerd, dan kan het gecodeerde getal alleen met de geheime sleutel gedecodeerd worden. Door nu alleen de de niet-geheime sleutel op de server van dienst te registreren, kan een authenticatie op een veilige manier gedaan worden. Zonder dat er nog kans bestaat op fishing of het diefstal van passwords van de servers van de winkel.</blockquote><p>Het klinkt allemaal simpel, dat is het technisch gezien ook. De grote uitdaging bleek uiteindelijk het komen tot een standaard die door alle browsers en login diensten vrij aangeboden kan worden. Die standaardisatie is nu gelukkig een feit.</p><p>In het komend jaar zullen alle grote browsers en smartphone aanbieders <em>WebAuthn</em> (spreek uit als <em>Web Authentication</em>) gaan ondersteunen. En ook hebben alle aanbieders van inlog software aangekondigd WebAuthn te gaan ondersteunen.</p><p>Voor het eerst sinds de introductie van de passwords (was dat in 1972 op de eerste Unix computers?) zullen we in 2023 gebruik kunnen een inherent veiliger systeem om in te kunnen loggen. En zullen veel password-fishers het een stuk moeilijker gaan krijgen. Laten we hopen dat dit allemaal snel voor ons allemaal beschikbaar komt!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4016952b3544" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EKS complete with eksctl / Sprint 4]]></title>
            <link>https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-4-7f356ab69aab?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f356ab69aab</guid>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[eksctl]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 15:15:43 GMT</pubDate>
            <atom:updated>2022-09-02T15:15:43.734Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok, <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-3-65eb6adf1629">in the last sprint </a>we implemented GitOps using <em>FluxCD</em>. Since we are doing GitOps we don’t need scrips anymore and rolling out apps or even a complete cluster is a repeatable task now. However, our app is still not reachable using a fixed DNS name. Time to fix this.</p><p>In this article we are going to introduce one extra repo and make changes on the other repo’s. Therefor please checkout sprint 4.</p><pre>git clone <a href="https://github.com/enschede/eks-demo.git">https://github.com/enschede/eks-demo.git</a><br>git checkout tag/sprint4<br>git submodule update</pre><p>You can clone it and, please, check out tag “sprint4”.</p><h3>Sprint goal</h3><p>The main goal for this sprint is to have a stable DNS-name for our app. We want de DNS-name to be available in Route53 (AWS’ DNS register) and coupled to the load balancer we introduced in sprint 2.</p><p>To have the DNS-name published we need to:</p><ul><li>Add a DNS-name controller that adds, modifies en removes DNS-entries.</li><li>Make the application reachable using a fixed DNS-name and https.</li></ul><p>Making the application reachable using a fixed DNS name requires a DNS name to be available somewhere in a DNS server. To do this, we will use Route53 and maintain the DNS records from our K8S descriptor files. And yes, this requires a new controller; the<em> binami external dns controller</em>.</p><p>And, as a bonus, we are going to make our GitHub repo’s private</p><h3>Adding the DNS controller</h3><p>First, we are going to create the <em>bitnami external dns controller</em> repo (grey) that will hold the and a reference to it in the <em>eks demo infra</em> repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Ot6QoED8jMWG-dVn-3x7Q.png" /></figure><p><strong>Adding the Bitnami external DNS controller</strong></p><p>The content of the Bitnami external DNS controller will look like this.</p><pre>eks-demo-bitnami-external-dns % tree<br>.<br>`-- deployment<br>    |-- external-dns.yaml<br>    `-- kustomization.yaml</pre><p><strong>deployment/external-dns.yaml</strong></p><p>The controller is packed in a Helm chart and we are able to load that Helm chart.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69ad8e039bd0b39f3edd9101b22b8e9d/href">https://medium.com/media/69ad8e039bd0b39f3edd9101b22b8e9d/href</a></iframe><p>The descriptor is not very special. Please note the value section and the end. The service account is not created by the helm chart because it cannot create the necessary role outside the cluster. Therefor we will create the service account from the <em>eksctl</em> configuration file. See later.</p><p><strong>deployment/kustomization.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c358dc02810f35858a22837cd19c6967/href">https://medium.com/media/c358dc02810f35858a22837cd19c6967/href</a></iframe><p><strong>Adding the controller repo to the eks demo infra repo</strong></p><p>Now that the dns controller repo is ready, we have to refer to it from the infra repo (blue). To do that, we will create an extra folder in the app-cluster folder in the infra repo. Like this:</p><pre>eks-demo-infra % tree<br>.<br>|-- app-cluster<br>|   |-- external-dns<br>|   |   |-- external-dns.yaml<br>|   |   `-- kustomization.yaml<br>...</pre><p><strong>deployment/external-dns.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c8c02e78a1eaf504db096afe199cf36/href">https://medium.com/media/0c8c02e78a1eaf504db096afe199cf36/href</a></iframe><p><strong>deployment/kustomization.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1753569a7bb49db249d8d6e46d21181e/href">https://medium.com/media/1753569a7bb49db249d8d6e46d21181e/href</a></iframe><p>Once both files are committed and pushed, the DNS-controller will start. Problem is that is will not work. Therefor we need to add an extra role in the <em>eksctl</em> configuration file.</p><p><strong>Adding the service account to EKS</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36bd8408d50aab6deef04cc3e11e20da/href">https://medium.com/media/36bd8408d50aab6deef04cc3e11e20da/href</a></iframe><p>As you can see, a service account is created and it is connected to a predefined role.</p><p>Restarting the cluster will do the job. The DNS controller will be part of the configuration.</p><h3>Add domain name to Ingress descriptor</h3><p>Now that we have the DNS controller available, we are going to add a DNS name in a descriptor file. But before we are going to do this, we will create a https certificate. To do so, we will go to the AWS certificate manager and add a certificate. The certificate will ask us to show that we are the owner of the domain, I hope you are able to walk through the process yourself, I created a <em>*.liberaalgeluid.nl</em> certificate. Why, that is the domain of an old podcast I used to make with a friend of mine and it is my testdomain now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O3L3-JkTRJ-DVxDlPzbsJA.png" /></figure><p>Now that there is a certificate for the domain, please copy the ARN of the certificate. We will need this one in the next step.</p><p>And in this next step we are going to modify the ingress.yaml part of the spring-boot-app.yaml configuration in the eks-demo-app repo (dark red).</p><p><strong>configuration/spring-boot-app.yaml</strong> (only the ingress part)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61bb73d53d28412182b376863e6afc62/href">https://medium.com/media/61bb73d53d28412182b376863e6afc62/href</a></iframe><p>The lines 15 to 18 are added. As you can see, the ingress will have 3 different DNS-name, it will have 4 ports to listen, all http traffic is redirected to an https port and a certificate is configured.</p><p>The certificate in line 18 is defined by its ARN. And, as you can see, my AWS account id is replaced by a variable that has to be substituted.</p><p>To substitute the variable, we need to update the kustomization in the infra repo.</p><p><strong>app-cluster/eks-demo-app/eks-demo-app.yaml</strong> (blue)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/53df761d08c5ebf4f41633e534a5c4e1/href">https://medium.com/media/53df761d08c5ebf4f41633e534a5c4e1/href</a></iframe><p>2 new parts are added:</p><ul><li>lines 28–31 are added to substitute variables. The values comes from a secret. We have to add the secret from outside the cluster. See later.</li><li>lines 32–34 are added to define a dependency. I guess you will understand.</li></ul><p>As said, we need the account id to be added as a secret. Therefor we will extend the start.sh script as below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbf4e53863a985e5608b9626d7353cd6/href">https://medium.com/media/bbf4e53863a985e5608b9626d7353cd6/href</a></iframe><p>The secret can now be added during startup. Of course you can execute the create secret command stand alone to prevent a restart.</p><p>Now it is time to test the DNS entry. Check below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XN2tBbme3G4Y2dqQ0ks9ag.png" /></figure><h3>Retro</h3><p>Ok, in the last sprints we created an app to show data. We added a load balancer, GitOps with FluxCD and a fixed DNS-name using Route53.</p><p>Still, the content is not very flexible. So in the next sprint we want to introduce a database in the cloud. And to create that database, outside of the cluster, we are going introduce Crossplane.</p><h3>Bonus: Make git repo’s private</h3><p>Till now all GitHub repo’s were public. This is not exactly what we want in commercial situations. We want our code to be private.</p><p>So, as a bonus, we are going to make our repo private. Or at least, I’m going to tell you how to make your repo’s private. I will leave my eks-demo repo’s public of course.</p><p>Luckily this is very simple with FluxCD. First we have to add the GitHub username and token as secrets to the flux-system namespace.</p><p><strong>start.sh</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b10fccd3e661ffcedd7b3bfe300070b4/href">https://medium.com/media/b10fccd3e661ffcedd7b3bfe300070b4/href</a></iframe><p>As you can see, a github-credential secret is added.</p><p>Next the GitRepository descriptors have to have a reference to the secret</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a0ee85de65df2c0c52d7c601119a798/href">https://medium.com/media/2a0ee85de65df2c0c52d7c601119a798/href</a></iframe><p>By adding a secretRef to the github credentials, FluxCD has the access to the private repo’s. Finally we have to change the settings in the GitHub repo to private 😀.</p><p>Happy developing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f356ab69aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EKS complete with eksctl / Sprint 3]]></title>
            <link>https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-3-65eb6adf1629?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/65eb6adf1629</guid>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Fri, 19 Aug 2022 19:42:24 GMT</pubDate>
            <atom:updated>2022-09-02T17:21:20.851Z</atom:updated>
            <content:encoded><![CDATA[<p>In this sprint we are going GitOps!</p><p>Since <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-2-6ec2ab518e76">sprint 2</a> we are able to deploy a spring boot app to an EKS cluster and publish it to the world. Unfortunately it is all scripted using unix shells. That is not what we want. So in this sprint we are going to start GitOps.</p><p>In this article we are going to use 4 repo’s on GitHub; the parent repo that will contain the EKS scripts and a sub repo that will contain the Spring Boot app.</p><pre>git clone <a href="https://github.com/enschede/eks-demo.git">https://github.com/enschede/eks-demo.git</a><br>git checkout tag/sprint3<br>git submodule update</pre><p>You can clone it and, please, check out tag “sprint3”.</p><h3>Sprint 3</h3><p>The goal of this sprint is to introduce GitOps. And we are going GitOps with FluxCD.</p><p>I’m not going into the reasons why GitOps and declarative descriptors are better than maintaining shell scripts, there are enough discussions on that subject to be found on the Internet. My focus is on implementing GitOps.</p><p>In this sprint we will introduce FluxCD and start the load balancer controller and the app from FluxCD.</p><p>As a bonus I added a short script to start the the Kubernetes dashboard from FluxCD as well, just as a showcase to show how simple starting an application from FluxCD can be.</p><p>For those of you who want to know more about FluxCD, there is a marvelous track of video’s created by Geert Baeke on this subject and on Kustomize. Please check <a href="https://www.youtube.com/playlist?list=PLG9qZAczREKmCq6on_LG8D0uiHMx1h3yn">Youtube</a>.</p><h3>Overview</h3><p>Introducing FluxCD comes with 2 new repo’s; the <em>infra</em> repo and the <em>load balancer controller</em> repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SWwFEmaog5t8_EO8U8GGA.png" /></figure><p>The infra repo (blue) is loaded from the eks-demo.yaml in <em>eksctl</em> (red).</p><p>The <em>load balancer controller</em> (green) and <em>app</em> (purple) repo’s are referenced from the <em>infra</em> repo (blue).</p><h3>Creating a FluxCD infra (blue) repo</h3><p>To use FluxCD, it is necessary to create a FluxCD repo. This repo defines the <em>infrastructure</em> of FluxCD. Before creating the <em>infra</em> repo, we need to define 2 shell variables that contain the username and token that we will use for FluxCD.</p><pre>export GITHUB_TOKEN=...<br>export GITHUB_USER=...</pre><p>Now it is time to install FluxCD on your computer. On a Mac you can use <a href="http://brew install fluxctl"><em>brew install fluxctl</em></a> to install flux.</p><p>The following command will create a FluxCD infra repo on GitHub</p><pre>flux bootstrap github \<br>  --owner=$GITHUB_USER \<br>  --repository=eks-demo-infra \<br>  --branch=main \<br>  --path=app-cluster \<br>  --personal</pre><p>I personally added the infra repo to main project with the following command. (It up to you to organise your code on your computer the way you want it, of course)</p><pre>git submodule add <a href="https://github.com/enschede/eks-demo-infra.git">https://github.com/enschede/eks-demo-infra.git</a></pre><p><em>Important, please keep the variables and fluxctl on your computer. In the next steps we will see that eksctl has some FluxCD options. The truth is that eksctl just forks fluxctl as an underwater process, so are gonna need fluxctl in the future.</em></p><p>More information on FluxCD can be found on <a href="https://fluxcd.io/">https://fluxcd.io</a></p><h3>Use FluxCD from eks-demo.yaml (red)</h3><p>The next step is to use the infra repo from eksctl. We can do that by just adding a gitops branch to our eks-demo.yaml file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e30dd08406b6cfda7f7cdf57af0af98/href">https://medium.com/media/9e30dd08406b6cfda7f7cdf57af0af98/href</a></iframe><p>As mentioned before, <em>eksctl</em> just spawns <em>fluxctl</em> as a subprocess to activate to activate FluxCD, so the github variables need to be there.</p><p>Just (re)start your cluster using the following start.sh</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/433c772c1a0df86b50eaac32f5f1f4cd/href">https://medium.com/media/433c772c1a0df86b50eaac32f5f1f4cd/href</a></iframe><p>Or add FluxCD to an already running cluster using</p><pre>eksctl enable flux -f eks-demo.yaml</pre><p>When everything is done we can see FluxCD running using k9s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_JhRsIilAW0V63SaZd1Yw.png" /></figure><h3>Running the loadbalancer controller (green)</h3><p>Now that FluxCD is running, it is time to install de load balancer controller from FluxCD.</p><p>To do so, we can create a load balancer controller repo. Giving it an own repo may be a little bit overdone, but I like to give a seperate repo the as app or controller.</p><p>The load balancer controller repo has the following content</p><pre>eks-demo-load-balancer-controller % tree<br>.<br>`-- deployment<br>    |-- helm.yaml<br>    `-- kustomization.yaml</pre><p>With the following files</p><p><strong>deployment/kustomization.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f2e2e43a9722a9bb9092a600a5178a2/href">https://medium.com/media/0f2e2e43a9722a9bb9092a600a5178a2/href</a></iframe><p><strong>deployment/helm.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c035d4a9d48eb87f8bfb77741745513/href">https://medium.com/media/1c035d4a9d48eb87f8bfb77741745513/href</a></iframe><p>It tells that:</p><ul><li>there is a source in a HelmRepository on the given url</li><li>and there is a helm chart from the given HelmRepository. It is using the <em>aws-load-balancer-controller</em> service account that we defined in <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-2-6ec2ab518e76">sprint 2</a>.</li></ul><p>Now back to our infra repo. FluxCD needs to know about the existents of the load balancer controller. To do so we have to create a load-balancer-controller folder in the infra repo, like this</p><pre>eks-demo-infra % tree<br>.<br>`-- app-cluster<br>    |-- flux-system<br>    |   |-- gotk-components.yaml<br>    |   |-- gotk-sync.yaml<br>    |   `-- kustomization.yaml<br>    `-- load-balancer-controller<br>        |-- kustomization.yaml<br>        `-- load-balancer-controller.yaml</pre><p>app-cluster/load-balancer-controller/kustomization.yaml (blue repo)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afc7a81686a0b2a3115ed96ff9ce5934/href">https://medium.com/media/afc7a81686a0b2a3115ed96ff9ce5934/href</a></iframe><p>app-cluster/load-balancer-controller/load-balancer-controller.yaml (blue repo)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a4688483742543dd1da1df6cbf880bf/href">https://medium.com/media/3a4688483742543dd1da1df6cbf880bf/href</a></iframe><p>The kustomization.yaml and the load-balancer-controller.yaml are telling FluxCD about a the load balancer repo and how to load it.</p><p>After committing it all the repo’s FluxCD load the kustomization in the infra repo and learns about the load balancer repo. Once it is loaded, the HelmRepository and HelmRelease are loaded and activated, resulting in the load balancer controllers being loaded.</p><p>This all can be seen in k9s:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3OiZwU-rm1R2xOatB3L3Q.png" /></figure><p>Well, now that we arrived here we do have the load balancer controller running, same as in Sprint 2. Except that it is started from FluxCD and not from a shell script!</p><p>Finally, I added the green repo as a submodule of my main project using the following command. You can do something likewise.</p><pre>git submodule add \<br>  <a href="https://github.com/enschede/eks-demo-load-balancer-controller.git">https://github.com/enschede/eks-demo-load-balancer-controller.git</a><br></pre><h3>Running the app (purple)</h3><p>Ok, now that we have the load balancer controller running in FluxCD, it is time to add the app too. To do so, we need to create a kustomization file in the deployment directory of the app. For maintainability I merged the three descriptor files in one; spring-boot-app.yaml.</p><p>The deployment directory is like this</p><pre>eks-demo-app % tree<br>.<br>|-- deployment<br>|   |-- kustomization.yaml<br>|   `-- spring-boot-app.yaml<br>...<br></pre><p><strong>deployment/kustomization.yaml </strong>(purple repo)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5960818ff1fd92931fd21784fd7dfc7/href">https://medium.com/media/f5960818ff1fd92931fd21784fd7dfc7/href</a></iframe><p>The kustomization file simply calls the other yaml file</p><p><strong>deployment/spring-boot-app.yaml</strong> (purple repo)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69253bd138f1802f49ad6fa02139756f/href">https://medium.com/media/69253bd138f1802f49ad6fa02139756f/href</a></iframe><p>The spring-boot-app file contains the deployment, service and ingress descriptors.</p><p>And of course the app should be defined in the FlusCD infra repo. The structure will be like this</p><pre>eks-demo-infra % tree<br>.<br>`-- app-cluster<br>    |-- eks-demo-app<br>    |   `-- eks-demo-app.yaml<br>    |-- flux-system<br>    |   |-- gotk-components.yaml<br>    |   |-- gotk-sync.yaml<br>    |   `-- kustomization.yaml<br>    `-- load-balancer-controller<br>        |-- kustomization.yaml<br>        `-- load-balancer-controller.yaml</pre><p>And the descriptor file will be like this</p><p><strong>eks-demo-app/eks-demo-app.yaml</strong> (blue repo)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c13a6188cb41e8acf5cadc6122d14c4/href">https://medium.com/media/2c13a6188cb41e8acf5cadc6122d14c4/href</a></iframe><p>This descriptor refers to the eks-demo-app.git and looks for a file called kustomization.yaml in the /deployment directory.</p><p>Now, after committing all changes:</p><ul><li>The kustomization file in the infra repo points to the kustomization file in the app repo.</li><li>The kustomization file in the app repo refers to the descriptor file in the app repo.</li><li>And the descriptor file will work like before</li></ul><p>Now, if we are looking in k9s we will see the eks-demo-app container spinning up after a few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-3eAO8HrU7eomP-zznO-g.png" /></figure><p>Like in sprint 2, we have to find the DNS name of the load balancer to access the app from the browser.</p><h3>Retro</h3><p>Well, time for the retro.</p><p>Plus; we introduced GitOps using FluxCD. Starting and stopping is a repetitive task now and it allows us to grow.</p><p>Minus; still not a fixed DNS-name for the app.</p><p>So, in the <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-4-7f356ab69aab">next sprint</a> it is time to fix the DNS-name problem. And we going to introduce a configurable item in the Kubernetes scripts, configurable from FluxCD.</p><h3>Extra; adding the K8S dashboard</h3><p>I promised to add the Kubernetes dashboard to FluxCD, just to show how simple it is to enable an extra app.</p><p>To define the dashboard app on the cluster we are going to add a new set of files in a directory called dashboard. Like this:</p><pre>eks-demo-infra % tree<br>.<br>`-- app-cluster<br>    |-- dashboard<br>    |   |-- clusterrolebinding.yaml<br>    |   |-- dashboardrelease.yaml<br>    |   |-- dashboardrepo.yaml<br>    |   |-- kustomization.yaml<br>    |   |-- namespace.yaml<br>    |   `-- serviceaccount.yaml<br>    |-- eks-demo-app<br>    |   `-- eks-demo-app.yaml<br>    |-- flux-system<br>    |   |-- gotk-components.yaml<br>    |   |-- gotk-sync.yaml<br>    |   `-- kustomization.yaml<br>    `-- load-balancer-controller<br>        |-- kustomization.yaml<br>        `-- load-balancer-controller.yaml</pre><p><strong>app-cluster/dashboard/namespace.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba15e32f37768dd54f2df0aa9ca54423/href">https://medium.com/media/ba15e32f37768dd54f2df0aa9ca54423/href</a></iframe><p><strong>app-cluster/dashboard/serviceaccount.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a93862ff871712b66e7e487f7c64a7c/href">https://medium.com/media/0a93862ff871712b66e7e487f7c64a7c/href</a></iframe><p><strong>app-cluster/dashboard/clusterrolebinding.yaml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f571695a6164d9de07f312a6ef9f9fe/href">https://medium.com/media/3f571695a6164d9de07f312a6ef9f9fe/href</a></iframe><p>app-cluster/dashboard/dashboardrepo.yaml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c44cce7ef9a13536d07940c62d7edc6f/href">https://medium.com/media/c44cce7ef9a13536d07940c62d7edc6f/href</a></iframe><p>app-cluster/dashboard/dashboardrelease.yaml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85fed883d32b7e3c40484e556515cde2/href">https://medium.com/media/85fed883d32b7e3c40484e556515cde2/href</a></iframe><p>app-cluster/dashboard/kustomization.yaml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d038af41a7cf7758e9e1094f4cfe707c/href">https://medium.com/media/d038af41a7cf7758e9e1094f4cfe707c/href</a></iframe><p>After committing the dashboard app will be loaded as a new customization. This is probably not the best configuration, so please let me know if there is a better solution!</p><p>In k9s the dashboard app can be shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z--OafB7-p-g8dNdfeOHyw.png" /></figure><p>Happy developing and till sprint 4!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65eb6adf1629" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EKS complete with eksctl / Sprint 2]]></title>
            <link>https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-2-6ec2ab518e76?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ec2ab518e76</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[eksctl]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 21:59:51 GMT</pubDate>
            <atom:updated>2022-08-19T19:47:44.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jx0yfIXi_P39ACY0xtmIVw.png" /></figure><p>In <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-1-123d4ba99888">sprint 1</a> we created our first EKS cluster running a Spring Boot app.</p><p>In this article we are going to use 2 repo’s on GitHub; the parent repo that will contain the EKS scripts and a sub repo that will contain the Spring Boot app.</p><pre>git clone <a href="https://github.com/enschede/eks-demo.git">https://github.com/enschede/eks-demo.git</a><br>git checkout tag/sprint2<br>git submodule update</pre><p>You can clone it and, please, check out tag “sprint2”.</p><h3>Sprint 2</h3><p>The sprint goal for this sprint is to add a public entry point with a decent dns name, using a Kubernetes Ingress.</p><p>EKS uses EC2 Load Balancers as Ingress routers. So we are going to use them.</p><p>By the way, did you know the word <em>Ingress</em> comes from the Italian word <em>Ingress </em>which means <em>entrance</em> in English?</p><p>To see the code, please checkout tag sprint2.</p><h3>Coupling a Service Account to AWS</h3><p>To create an Ingress on EKS we have to take some hurdles.</p><ul><li>Create a bridge between Kubernetes and AWS security (called IAM)</li><li>Create a IAM policy</li><li>Create and link a Kubernetes service account</li></ul><p>In the next paragraph we will use eksctl to do the hard work for us. For those who are interested, the are 2 alternative ways to to do this for us. I worked these 2 alternatives out for you in the last paragraph of this sprint.</p><h3>Using eksctl</h3><p>We are going to extend the <em>eks-demo.yaml </em>file with an <em>iam</em> section</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/623ac7860c577d6cd153cb61a197e5e4/href">https://medium.com/media/623ac7860c577d6cd153cb61a197e5e4/href</a></iframe><p>The iam section in the yaml file tells eksctl:</p><ul><li>to associate Kubernetes and IAM</li><li>to create a service account named <em>aws-load-balancer-controller</em></li><li>and to use a well know policy. Yes, eksctl knows and maintains the policy for the load balancer controller. Luckily we don’t have to define the policy ourself 😀.</li></ul><p>Stop and start the cluster will include all necessary settings to the cluster</p><p>Now that we have created the service account in Kubernetes, we can install the load balancer controller controller.</p><h3>Adding a load balancer controller</h3><p>Having a service account that is empowered to create a load balancer is not enough to manage the load balancer. We do need a controller for that.</p><p>The load balancer controller checks the Ingress resource descriptors and adopts the load balancers according to those descriptors.</p><p>If you did not install Helm before, please use <a href="https://formulae.brew.sh/formula/helm"><em>brew install helm</em></a> to install Helm (on a Mac).</p><p>To install the load balancer controller, we execute the following commands</p><pre>helm repo add eks <a href="https://aws.github.io/eks-charts">https://aws.github.io/eks-charts</a></pre><pre>helm install aws-load-balancer-controller \<br>  eks/aws-load-balancer-controller \<br>  --namespace kube-system \<br>  --set clusterName=eks-demo \<br>  --set serviceAccount.create=false \<br>  --set serviceAccount.name=aws-load-balancer-controller</pre><p>The helm repo is add and the chart is installed.</p><h3>Creating an Ingress</h3><p>Ok, now that we have the controller installed we can finally install the Ingress resource for our app repo.</p><p>The <em>deployment/service.yaml</em> file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ea9dfadd201b3f6feaa12c66958efa1/href">https://medium.com/media/5ea9dfadd201b3f6feaa12c66958efa1/href</a></iframe><p>The <em>deployment/ingress.yaml</em> file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27b7cc7d6715d5d117678c5b6e8443c1/href">https://medium.com/media/27b7cc7d6715d5d117678c5b6e8443c1/href</a></iframe><p>The Ingress descriptor has a lot of AWS specific annotations:</p><p>It tells</p><ul><li>that an <em>internet-facing</em> load balancer has to be used.</li><li>that all Ingresses with the same group.name can share a load balancer for saving costs.</li><li>about all the health check parameters.</li></ul><p>Please note the <em>spec.type</em> nodein the service.yaml file has been changed to <em>ClusterIP</em>. The service cannot be access from outside the cluster anymore. To accommodate this, the <em>alb.ingress.kubernetes.io/target-type</em> node in the ingress.yaml file has to be set to <em>ip</em>.</p><p>Loading the whole stack can now be done using the following start.sh file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d45e08b77ceab73b881665743dd72429/href">https://medium.com/media/d45e08b77ceab73b881665743dd72429/href</a></iframe><p>Now, by looking into <em>k9s</em>, page :<em>ingress</em>, we can select the ingress we just created and find the external DNS name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLpq5F_8O13pmCsRIdxojQ.png" /></figure><p>Now, by surfing to the DNS name we just found and extending it with /hello, we can finally see the page in our app again!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqUhgqTvKG36fjHMKdXB7A.png" /></figure><h3>Retro</h3><p>Well new that we have everything in place it is time for the retro.</p><p>Plus; our app is reachable through the ingress/load balancer. No more modifications of secutiry groups.</p><p>Minus: there is still no fixed DNS name</p><p>Minus: even more imperative commands to be executed, we have to go gitops!</p><p>In the <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-3-65eb6adf1629">next sprint </a>we will introduce FluxCD to implement GitOps on eksctl. And after that we will implement a Route53 DNS name, load balancers, IPv6, Crossplane and a whole lot more!</p><h3>Alternative 1; create a service account in the shell</h3><p>Eksctl has to tools to create a service account from the shell. We can do this by changing our <em>start.sh</em> file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3219cc337a5376507afdf264a207f5e/href">https://medium.com/media/f3219cc337a5376507afdf264a207f5e/href</a></iframe><p>The start.sh file:</p><ul><li>Starts the cluster by using the <em>eksctl create cluster</em> command</li><li>Executes the <em>eksctl utils associate-iam-oidc-provider</em> command to couple Kubernetes and IAM using the internal OIDC.</li><li>Executes the <em>aws iam create-policy </em>command to create a policy</li><li>And executes the <em>eksctl create iamserviceaccount</em> to create a service account in Kubernetes and couple it to the policy we just created</li></ul><h3>Alternative 2; don’t use a well known policy</h3><p>This alternative is usefull if we cannot, for whatever reason, use a well known poilcy.</p><p>For me, I prefer to use a well known policy as it is maintained by <em>eksctl</em>. I don’t have to update the policy myself if it has to be changed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d319a7994ccc4004bc681da7edf52d9/href">https://medium.com/media/2d319a7994ccc4004bc681da7edf52d9/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ec2ab518e76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EKS complete with eksctl / Sprint 1]]></title>
            <link>https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-1-123d4ba99888?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/123d4ba99888</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[eksctl]]></category>
            <category><![CDATA[flux]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Wed, 27 Jul 2022 20:05:01 GMT</pubDate>
            <atom:updated>2022-08-07T20:22:34.739Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jx0yfIXi_P39ACY0xtmIVw.png" /></figure><p>Setting up a Kubernetes cluster is a lot of work. Thanks to the guys and galls of Amazon we do have EKS; Kubernetes in the cloud solution. Using EKS saves us a whole lot of time and headaches. But still EKS has to be configured too.</p><p>In this set of stories I’m going to share my EKS configuration with you. I’m going to use Flux v2, an Elastic Load Balancer, Crossplane, a cloud database, Route53, Cluster Autoscalers, Serverless containers, certificate management, eksctl, AWS IAM integration and a whole lot more.</p><h3>Sprint 1</h3><p>The sprint goal of the first story is to create a Spring Boot application running on a EKS cluster just saying “Hello” to the world.</p><h3>Prerequisites</h3><p>I assume that you have basic knowledge of Kubernetes and Bash/Zsh-shells. And you have knowledge of handling Git and Git submodules.</p><h3>Setting up the project repo</h3><p>In this article we are going to use 2 repo’s on GitHub; the parent repo that will contain the EKS scripts and a sub repo that will contain the Spring Boot app.</p><pre>git clone <a href="https://github.com/enschede/eks-demo.git">https://github.com/enschede/eks-demo.git</a><br>git checkout tag/sprint1<br>git submodule update</pre><p>You can clone it and, please, check out tag “sprint1”.</p><h3><strong>The eks-demo-app</strong></h3><p>The app is a Spring Boot app using Kotlin and Maven. It contains the <em>web</em> and <em>actuator</em> dependencies and has a get-endpoint /hello that will tell hello to everybody on this world.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0a3700d09859aaabd31b8b4d071a6cd/href">https://medium.com/media/f0a3700d09859aaabd31b8b4d071a6cd/href</a></iframe><p>The pom-file will make sure that a docker image can be build from Maven</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f27621bdc93febca2881ab2f7929683/href">https://medium.com/media/9f27621bdc93febca2881ab2f7929683/href</a></iframe><p>Building and pushing the app uses the following commands</p><pre>mvn spring-boot:build-image</pre><pre>docker push enschede/eks-demo-app:sprint1</pre><p>The Spring Boot app is stored in the repo enschede/eks-demo-app and is configured as a submodule of the eks-demo project.</p><h3>Starting my EKS cluster with <em>eksctl</em></h3><p>To start, stop and configure the cluster we do need the eksctl tool. This tool can be installed (on a Mac) using <a href="https://formulae.brew.sh/formula/eksctl"><em>brew install eksctl</em></a>.</p><p>Configuring and starting an EKS cluster is fairly simple. Lets first go through the configuration file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b86067f6c21a75bb327fbb635013df3/href">https://medium.com/media/0b86067f6c21a75bb327fbb635013df3/href</a></iframe><p>The iam.withAddonPolicies.cloudWatch tells eksctl the node will have access to write to CloudWatch.</p><p>Starting and stopping using the right files.</p><p>start.sh</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/433c772c1a0df86b50eaac32f5f1f4cd/href">https://medium.com/media/433c772c1a0df86b50eaac32f5f1f4cd/href</a></iframe><p>stop.sh</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3182efa66f7df53ea993745f5047c4f2/href">https://medium.com/media/3182efa66f7df53ea993745f5047c4f2/href</a></iframe><p>The cluster can now be started using the start script.</p><h3>Using k9s</h3><p>After starting the cluster using the start.sh command, we will use k9s to see what pods are running in the cluster.</p><p>k9s is a text oriented tool to dive into a Kubernetes cluster very easily and can be installed (on a Mac) using <a href="https://formulae.brew.sh/formula/k9s"><em>brew install k9s</em></a> and can be started by typing <em>k9s</em>. k9s is inspired by vi and so to select the pods screen type</p><pre>:pod</pre><p>This will show a screen like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBuIFFQY-bZRgTV_TiTyFQ.jpeg" /><figcaption>K9s pod screen</figcaption></figure><h3>Running the app</h3><p>Now that we have pushed the Spring Boot Docker image and the started the EKS, it is time to run the app on EKS. Therefor we do have a deployment and a service descriptor</p><p>There is the <em>deployment.yaml</em> descriptor</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90425a31eb73b255d30ecad46755dfde/href">https://medium.com/media/90425a31eb73b255d30ecad46755dfde/href</a></iframe><p>And the <em>service.yaml</em> descriptor</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cc017ed8e3b0ac9ba5b21c0ff4db06e/href">https://medium.com/media/8cc017ed8e3b0ac9ba5b21c0ff4db06e/href</a></iframe><p>Starting the file app</p><pre>kubectl apply -f deployment/deployment.yaml</pre><pre>kubectl apply -f deployment/service.yaml</pre><p>Now that our app is deployed, we can watch it running using k9s. By typing :service we can see the service running on nodeport 3000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwRgKK35IGmV94k717MOCQ.jpeg" /><figcaption>k9s :svc screen</figcaption></figure><p>By typing <em>:node</em> in k9s we can see the node running and by selecting the letter <em>d</em> (of describe) we can find more information on the node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvxvhGCkFQVOTgvO05ST2g.png" /></figure><p>From the node screen in k9s we do copy the external dns name, from the service screen in k9s we do pick the nodeport and from the getmapping in the controller we need the endpoint. We can compose this into a url:</p><p><a href="http://ec2-34-219-77-37.us-west-2.compute.amazonaws.com:30000/hello">http://ec2–34–219–77–37.us-west-2.compute.amazonaws.com:30000/hello</a></p><p>A we there? Not quite, we cannot reach the node from the outside world. Therefor I altered the security group that allows ssh access from the outside world to allow tcp traffic to port 30000 as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhxR1-lqkYZ5Oc9f4Nzypw.png" /><figcaption>Adding TCP traffic to port 30000 in the security group</figcaption></figure><p>And finally, we can reach our app from the outside world</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDzXIt4_NWZoYx747eJNyg.png" /></figure><h3>Retro</h3><p>Plus: the app is running and we can reach it.</p><p>Minus: finding an IP-address of the node and altering a security group is not a solution to be proud of. Using an Ingress router and a dns name is a better solution.</p><p>Minus: loading the descriptor files by hand is not a nice solution. We have to go gitops.</p><p>In the <a href="https://marcenschede.medium.com/eks-complete-with-eksctl-sprint-2-6ec2ab518e76">next sprint</a> we will implement an ingress router, based on a AWS load balancer.</p><p>In later sprints we will go on with GitOps, Crossplane, IPv6 and all other cool stuff.</p><h3>Useful commands</h3><p><strong>eskctl</strong></p><ul><li>eksctl create cluster</li><li>eksctl delete cluster</li><li>eksctl get cluster</li><li>eksctl get cluster &lt;clustername&gt;</li></ul><p><strong>k9s</strong></p><ul><li>:pod</li><li>:svc</li><li>:deploy</li><li>:quit</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=123d4ba99888" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using TestContainers for Spring Boot integration tests]]></title>
            <link>https://marcenschede.medium.com/using-testcontainers-for-spring-boot-integration-tests-8458768b3bee?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8458768b3bee</guid>
            <category><![CDATA[testcontainer]]></category>
            <category><![CDATA[integration-testing]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Tue, 15 Jun 2021 21:46:45 GMT</pubDate>
            <atom:updated>2021-06-15T21:46:45.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7LVI_ZNUNCE93dh9oqzWw.jpeg" /></figure><p>It was the evening of the French-German football game for the European Championship and while watching the game using one eye, I had the time to figure out how to create an integration tests using two Spring Boot connected components.</p><h3>Setup</h3><p>The setup of the Spring Boot components is quite simple. There are two Spring Boot components; module1 and module2. Module1 forwards a request to module2.</p><p><em>http client (like curl)-&gt; module1 -&gt; module2</em></p><h3>Integration test</h3><p>In the integration test we want to load both container module1 and module2. The integration test calls module1 and verifies the answer.</p><p><em>Integration test -&gt; module1 -&gt; module2</em></p><p>The project <em>testcontainers</em> has a module <em>it</em>, which contains the integration test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*23juATOLqNGycr5Bk5rkRw.png" /></figure><p>First, we need Testcontainers to be in the pom file (in short)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d78dca969c9449a1a52e9b5746e4bbb7/href">https://medium.com/media/d78dca969c9449a1a52e9b5746e4bbb7/href</a></iframe><p>To load all the docker containers and have them connected, Docker compose is our friend. The docker compose file is very straightforward.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ec3f6c09b6ba022987777621e7a97e5/href">https://medium.com/media/6ec3f6c09b6ba022987777621e7a97e5/href</a></iframe><p>And finally, there is the integration test</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5431e7a2c18c8b1fce349102181e187d/href">https://medium.com/media/5431e7a2c18c8b1fce349102181e187d/href</a></iframe><p>The test is quite simple, first a compose environment is defined. The <em>withExposedService</em> methods will make sure that Testcontainers will wait until both services are up and ready.</p><p>Next, the compose set is started and finally the real test is run.</p><p>As you see, starting a set of Spring Boot micro services can be started simple using Testcontainers and Docker Compose to run a fine integration test.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8458768b3bee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I used Flux CD v2 to deploy Spring Boot to my EKS cluster]]></title>
            <link>https://marcenschede.medium.com/i-used-flux-cd-v2-to-deploy-spring-boot-to-my-eks-cluster-9c1306d80106?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c1306d80106</guid>
            <category><![CDATA[flux-cd]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Mon, 31 May 2021 20:34:16 GMT</pubDate>
            <atom:updated>2021-05-31T20:34:16.495Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuous Deployments rocks. And FluxCD rocks. As a hard-core Spring Boot fan I wanted to use Flux CD v2 to deploy a Spring Boot application on a EKS cluster. And I wanted to use GitHub Actions. Here’s what I found out.</p><h3>Bootstap FluxCD on Kubernetes</h3><p>First of all, I had to make sure Kubernetes and Flux were working. I used EKS on AWS and installed Flux on my laptop using <em>brew</em>. Then I had to load Flux v2 onto Kubernetes. I had to use the following commands</p><pre>export GITHUB_TOKEN=******<br>export GITHUB_USER=enschede</pre><pre>flux bootstrap github \<br>  --owner=$GITHUB_USER \<br>  --repository=scratch-infra \<br>  --branch=main \<br>  --path=app-cluster \<br>  --personal</pre><p><em>Of course, you should know your own GitHub username and a GitHub token can be obtained from GitHub.</em></p><p>The bootstrap command creates a repository scratch-infra on GitHub, loads some configuration files and starts Flux on Kubernetes. Flux is configured to have a look at the repo every minute for configuration changes in the app-cluster folder of the main branch in the repo.</p><p>After cloning the repo on my local laptop, it looked like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*3FmNH9hXFC-UBXCufYpLgg.png" /></figure><p>It is good to note that the bootstap command is idempotent. You can repeat the command to load FluxCD to your Kubernetes cloud after you created a fresh one.</p><p>Adding an app</p><p>Now that I had FluxCD running on my cluster, I wanted of course to add an app. To do so, I had to add two configuration files to the repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*b89Se6G_KH-aDOBk4yck4Q.png" /></figure><p>The files had to contain the following content</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c25750598c76bd7002b784745248f5e5/href">https://medium.com/media/c25750598c76bd7002b784745248f5e5/href</a></iframe><p>Basically, both files are telling flux that there is a Kustomization file in the ./deployment folder in the master branch of the https://github.com/enschede/springbootflux repository. The Kustomization file has to be inspected every 30 seconds to see if it is updated.</p><p><em>(I guess it is clear that these files are to be committed and pushed to GitHub)</em></p><h3>The Spring Boot app</h3><p>Now that FluxCD know that something is going on in the springboorflux repo, I had to make sure to put this repo in place. It looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*J_9NikgsvdlnwCz84PTizw.png" /></figure><p>I guess the Spring Boot app as well a the Kubernetes deployment files familiar, so I will focus on the kustomization file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df5c97a8782f5d112df35beebe700d1c/href">https://medium.com/media/df5c97a8782f5d112df35beebe700d1c/href</a></iframe><p>This kustomization tell FluxCD that:</p><ul><li>To override all namespaces to springbootflux-dev</li><li>To add <em>-dev</em> to all names in the Kubernetes definition files</li><li>To use the 6 filesmentioned under resources</li><li>To override the number of replica’s to 1</li><li>And to override the tag of the mentioned image to enschede/springbootflux</li></ul><p>After committing and pushing this, the Spring Boot started.</p><h3><strong>Watching Kubernetes and FluxCD</strong></h3><p>Of course I wanted to know if the deployment went well. To do so I use 2 familiar commands:</p><pre>kubectl get all -n springbootflux-dev <br>watch flux get kustomizations</pre><p>The deployment, replicaset, pod and configs were there.</p><p>Continues Deployments with GitHub Actions</p><p>Although the Spring Boot app was running on EKS, there was no Continues Deployment. So I added a small GitHub Action workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*RQXfxUF4bPvbUMHs4DFrRQ.png" /></figure><p>The deploy.yml file contains the following workflow</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed2e70d95b988923f21e210c3977b01f/href">https://medium.com/media/ed2e70d95b988923f21e210c3977b01f/href</a></iframe><p>In the last step, the kustomize command updates the kustomize file. The image tag is updated to ${{ github.sha }}. After doing so the change is committed and pushed. FluxCD can pick up this change and install the new docker image on the cluster!</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c1306d80106" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot: Using Liquibase to load test and demo data]]></title>
            <link>https://marcenschede.medium.com/spring-boot-using-liquibase-to-load-test-and-demo-data-a7f9810066bc?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7f9810066bc</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[liquibase]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Tue, 18 May 2021 20:04:22 GMT</pubDate>
            <atom:updated>2021-05-18T20:13:50.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7LVI_ZNUNCE93dh9oqzWw.jpeg" /></figure><p>In one of my previous project we had to preload some test/demo data into our database on the DEV and TST environments, but of course not in the PROD environment. As we deployed the system over and over again on DEV, TST and our local machines we wanted to have that test data loader automatically. In our Spring Boot environment we used Liquibase to load the database schema and we wanted to load the test data using Liquibase as well. So we used Liquibase contexts.</p><p>In the first step a pair of Liquibase changesets is defined; the common changeset (without a context) and the dev changeset (annotated with the <em>dev</em> context). If the dev context is defined both changesets are executed, if another context is given (like <em>prod</em>) only the first changeset is executed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5481e3dd07583e911f98e4fb60d45bb6/href">https://medium.com/media/5481e3dd07583e911f98e4fb60d45bb6/href</a></iframe><p><em>A small warning; if no context is defined at all, the context system will be switched off. So if no context is defined, both contexts are executed. To avoid that you have to define some arbitrary context.</em></p><p>Now, how do we make sure that the right context is deployed to the right stage. We can use spring profiles.</p><p>In the application.properties the contexts like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2b41c1c52bdd50b56bacbb6541f8386/href">https://medium.com/media/b2b41c1c52bdd50b56bacbb6541f8386/href</a></iframe><p>For the deployment to the DEV environment, we will override the context in the application-dev.profile like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f60d4617dbfb23ca8dc01027432520e6/href">https://medium.com/media/f60d4617dbfb23ca8dc01027432520e6/href</a></iframe><h3>Testing data migrations</h3><p>Now imagine our product owner comes in and asks us the add a nickname column and to generate a nickname for existing users as “&lt;name&gt; from nowhere’. Of course we want to test the data migration. Therefor we define a next pair of changesets.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e91fb98c6d04ff531d7cb1a06d9b0b1/href">https://medium.com/media/3e91fb98c6d04ff531d7cb1a06d9b0b1/href</a></iframe><p>If the <em>prod</em> context is select, the existing data is converted. More interesting is to see what is happening in the <em>dev</em> context. First, the 18s01 and 18s01dev changesets are executed. Then the 18s02 context is executed and as a result, the testdata from the 18s01dev changeset is converted. As a result, we are able to verify if the testdata is converted as expected.</p><p>As expected, it is possible to create a more complex situation. For example to have 3 context; <em>prod</em> without preloaded data, <em>tst</em> with test data preloaded and <em>demo</em> to add both test and demo data.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7f9810066bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a mono repo containing Java and Kotlin based Spring Boot minions]]></title>
            <link>https://marcenschede.medium.com/setting-up-a-mono-repo-containing-java-and-kotlin-based-spring-boot-minions-6c8c01ac551d?source=rss-92de48d250a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c8c01ac551d</guid>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Marc Enschede]]></dc:creator>
            <pubDate>Sat, 19 Oct 2019 23:01:31 GMT</pubDate>
            <atom:updated>2019-10-30T07:40:43.553Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you have to deal with version hell in your microservice (we call them <em>minions</em>) farm? A mono repo can be the solution. I heard about this a short time ago and I do recognise the challenges the mono repo is about to solve; helping to solve versioning problems with minions and allow developers to do atomic commits.</p><p>I’m not going deep into the details and pro’s-and-con’s of the mono repo. There is a lot to be found on the Internet and there is a page on <a href="https://en.wikipedia.org/wiki/Monorepo">Wikipedia</a> as well. This article shares a way to create a mono repo for Spring Boot based minions.</p><p>This article shows how to setup a mono repo consisting of one backend component and two frontend components, all Spring Boot based and using Java as well as Kotlin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeNA_DxKmW1JbpWQ-S_U3A.png" /></figure><p>The following recipe shows how to setup the mono repo;</p><p>First create a root pom file. The file defines a pom package type and does not contain any dependency definitions. Why? General definition apply for all minions at the same time and you don’t want to be forced to update all minions at once when you only want to update the Spring version of one minion. You can define some versions here if they apply to all you minions, it is easy to override such a version number on a deeper level if needed.</p><p>The only part that is really needed is the &lt;modules&gt; element, it defines which modules belong to the tree. And yes, I’m a big fan of gitflow and that is also to be defined on the root level.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec0a89013d0b13a6d328b1253bd9754a/href">https://medium.com/media/ec0a89013d0b13a6d328b1253bd9754a/href</a></iframe><h4>A backend service</h4><p>The first real component is the minion we want to create. Let’s say a backend service. We want this backend service to have a REST endpoint and we want to share the object model for that rest service to be available for it’s clients. So, we are going to create an intermediate pom module. Again it defines a pom package.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/450d4219d1e1a2346e0b5b971fa77a2c/href">https://medium.com/media/450d4219d1e1a2346e0b5b971fa77a2c/href</a></iframe><p>Please <strong><em>don’t forget</em></strong> to define this module in the root pom!</p><p>Now we can create the sub module containing the object model for the endpoint of out service. For this interface it my choiche to create it as a seperate module, just to be able to import it in the clients. A disadvantage is that this may lead to strong coupling, something you may want to avoid. Nevertheless, if you want to do it this way this can be an example.</p><p>This module is a sub module of the backend-parent module we just defined.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73deb56e2d26d6c8922b00bf3df64d5a/href">https://medium.com/media/73deb56e2d26d6c8922b00bf3df64d5a/href</a></iframe><p>And again, <strong><em>don’t forget</em></strong> to add this module to it’s parent!</p><p>This pom file is created kotlin-archetype-jvm template, you may choose another one. Please check the executions defined in the kotlin-maven-plugin, the test-compile execution is needed and is not a part of the default plugin settings. Your tests won’t run if this phase is not defined.</p><p>In the interface module we do have to define the object model only</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4680cd2a61b4b3f06e6feed36cef6b6/href">https://medium.com/media/c4680cd2a61b4b3f06e6feed36cef6b6/href</a></iframe><p>Just plain old Kotlin objects (are the called Poko’s?)</p><p>Now we can create our first Minion, the backend service minion. It is a good idea to create this minion right from start.spring.io and modify the file afterwards. The module is to be created a a child of the backend parent module (so next to the interface module) and again, don’t forget to add this module in the… (yes, you know). Our new pom file should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eacbe74bb171c9d1adc1f9908f69e5f/href">https://medium.com/media/0eacbe74bb171c9d1adc1f9908f69e5f/href</a></iframe><p>Let’s walk through the modifications:</p><ol><li>In the properties part I choose a different spring-boot.version. It overrides the property from the root pom. Just for demo 🙂</li><li>Then the dependency management element. We do need this one because we do not inherit it from the parent pom.</li><li>The executions-element should be added to the kotlin-maven-plugin.</li><li>And finally, the maven-surefire-plugin should be added.</li></ol><p>It is important to recognise that the last two steps can easily be forgotten. The build will not fail without them. However, if one step is forgotten the test will not run! Therefor it is always a good idea to test these build scripts with a failing test.</p><p>The repositories elements are added because this example is based on a beta version of Spring.</p><p>The controller self is quite simple. No further comments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86f133d56db266c7471e3cf65daa213f/href">https://medium.com/media/86f133d56db266c7471e3cf65daa213f/href</a></iframe><p>After creating the backend service, it is time to create the frontend service. For this component we do create a Java based Spring module right under the root project.</p><p>The pom file will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94e5b56fcfc5c51daa4f57aeba105478/href">https://medium.com/media/94e5b56fcfc5c51daa4f57aeba105478/href</a></iframe><p>Just like for the backend application, the pom file has the root pom as it’s parent, the dependencyManagement-element and the surefire plugin. However, the Kotlin-mavenplgin is replaced by the maven-compiler-plugin. This plugin does compile the main code as well as the test code by default.</p><p>Now that we have a server and a client minion, both sharing an interface definition, we can build it all using maven clean install. From here you can create a feature branch, update the code (like updating the interface object model) and build-and-test all minions. Once the it works, you can merge it to the develop-branch!</p><p>All code can be found on <a href="https://github.com/enschede/monorepo-tutorial.git">GitHub</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c8c01ac551d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>