<?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 Muhammad Fauzi Islami on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Fauzi Islami on Medium]]></description>
        <link>https://medium.com/@islamifauzi?source=rss-6e7147fa40b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bj4l150a_t8WxMFK</url>
            <title>Stories by Muhammad Fauzi Islami on Medium</title>
            <link>https://medium.com/@islamifauzi?source=rss-6e7147fa40b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 07:54:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@islamifauzi/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[Service Mesh : Istio and Kiali Setup]]></title>
            <link>https://islamifauzi.medium.com/service-mesh-istio-and-kiali-setup-da99d60ba415?source=rss-6e7147fa40b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/da99d60ba415</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[service-mesh]]></category>
            <dc:creator><![CDATA[Muhammad Fauzi Islami]]></dc:creator>
            <pubDate>Mon, 26 Jul 2021 05:40:19 GMT</pubDate>
            <atom:updated>2021-07-27T05:09:07.749Z</atom:updated>
            <content:encoded><![CDATA[<h3>Service Mesh : Istio and Kiali Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*XWrXhruE78XdZxTBVyn1qQ.png" /></figure><p>It’s the first time for me to learn what service mesh is, how it works, and how to start the lab to deep dive on this stuff. In this article, there will be some of my notes about how to install Istio and see the visualization of some microservices that will have been monitored by Istio and I’m going to write it up now.</p><p>As usual, it would be better if we have good comprehension on what we’re going to learn.</p><blockquote>A service mesh is a dedicated infrastructure layer that you can add to your applications. It allows you to transparently add capabilities like observability, traffic management, and security, without adding them to your own code</blockquote><p>source : <a href="https://istio.io/latest/about/service-mesh/">https://istio.io/latest/about/service-mesh/</a></p><p>Based on the explanation above, we should have known what service mesh is. I’m going to conclude it simpler : <strong>“Service mesh is a way to ease our life in order to manage microservice apps with its complexity of growth” (</strong><em>I hope I don’t get it wrong hahaha)</em></p><p>So let’s have some practices right away!</p><ol><li>Download Istio Release</li></ol><p>We can download it either from the latest version or certain version we want to install. I assume we use linux for this labs, here I use minikube that is running on Centos 7.</p><p>Honestly when I was deploying the manifest I experienced some issues that made me confused quite a bit for hours.( it might be I use minikube for this labs but not for sure ). Anyway, after doing some tshoots, gotcha!! I can move on to the other part of this lab. <em>Just ranting anyway :D</em></p><p>Download the latest version :</p><pre>curl -L <a href="https://istio.io/downloadIstio">https://istio.io/downloadIstio</a> | sh -</pre><p>Or we can download another version as well :</p><pre>curl -L https://istio.io/downloadIstio | ISTIO_VERSION=[VERSION] TARGET_ARCH=[CPU_ARCH] sh -</pre><p>Since I do the labs and write this article, I use Istio v1.9.0 , it might be some different steps but however it should the same in general.</p><p>2. Copy <em>istioctl </em>binary file into system path</p><pre>cp ~/istio-1.9.0/bin/istioctl /usr/local/bin</pre><p>We can also do this way :</p><pre>export PATH=$PWD/bin:$PATH</pre><p>3. Install Istio Core, Istiod, Ingress Gateway</p><p>These 3 things are components that will run as control plane. I’ll try to separate about istio components in other occasion ( I’ve to learn more first hahaha)</p><pre>istioctl install</pre><pre>output :<br> <br>✔ Istio core installed<br>✔ Istiod installed<br>✔ Ingress gateways installed<br>✔ Installation complete</pre><p>As simple as that :)</p><p>Then, 2 pods of istio should be appeared on istio-system namespace :</p><pre>kubectl get pods -n istio-system</pre><pre>output :</pre><pre>NAME                                    READY   STATUS    RESTARTS   AGE<br>istio-ingressgateway-66644ff9c8-nngfb   1/1     Running   0          13s<br>istiod-866c5d9599-wz6k5                 1/1     Running   0          13s</pre><p>4. Deploy microservice apps</p><p>For this labs, I clone kubernetes manifest of microservice apps from <a href="https://github.com/GoogleCloudPlatform/microservices-demo">https://github.com/GoogleCloudPlatform/microservices-demo</a></p><pre>git clone <a href="https://github.com/GoogleCloudPlatform/microservices-demo">https://github.com/GoogleCloudPlatform/microservices-demo</a></pre><p>Then, go to the release directory</p><pre>cd microservices-demo/release &amp;&amp; ls</pre><pre>output :</pre><pre>istio-manifests.yaml  kubernetes-manifests.yaml</pre><p>Apply the manifest</p><pre>kubectl apply -f kubernetes-manifest.yaml</pre><pre>output : </pre><pre>deployment.apps/emailservice created<br>service/emailservice created<br>deployment.apps/checkoutservice created<br>service/checkoutservice created<br>deployment.apps/recommendationservice created<br>service/recommendationservice created<br>deployment.apps/frontend created<br>service/frontend created<br>service/frontend-external created<br>deployment.apps/paymentservice created<br>service/paymentservice created<br>deployment.apps/productcatalogservice created<br>service/productcatalogservice created<br>deployment.apps/cartservice created<br>service/cartservice created<br>deployment.apps/loadgenerator created<br>deployment.apps/currencyservice created<br>service/currencyservice created<br>deployment.apps/shippingservice created<br>service/shippingservice created<br>deployment.apps/redis-cart created<br>service/redis-cart created<br>deployment.apps/adservice created<br>service/adservice created</pre><p>Check those pods ( it took about 2 minutes for pods to run in my machine )</p><pre>kubectl get pods</pre><pre>output :</pre><pre>NAME                                     READY   STATUS             RESTARTS   AGE<br>adservice-75f6d84ddd-bbxzk               1/1     Running            0          2m21s<br>cartservice-75d66997cf-2f7bq             1/1     Running            1          2m22s<br>checkoutservice-855cd595b4-f8mrr         1/1     Running            0          2m22s<br>currencyservice-5b74f955c4-5jfcv         1/1     Running            0          2m21s<br>emailservice-95cc959f8-thrdz             1/1     Running            0          2m22s<br>frontend-79c8999fb6-cnkk6                1/1     Running            0          2m22s<br>loadgenerator-589648f87f-pvtfn           1/1     Running            0          2m22s<br>paymentservice-7d679d5b98-wkgsz          1/1     Running            0          2m22s<br>productcatalogservice-5f7d6665c6-2gpm7   1/1     Running            0          2m22s<br>recommendationservice-7569586f96-ndslt   1/1     Running<strong>            </strong>4          2m22s<br>redis-cart-5b569cd47-8bwhs               1/1     Running            0          2m21s<br>shippingservice-749b654bb4-7d9l7         1/1     Running            0          2m21s</pre><p>5. Inject sidecar container to each pods</p><p>Look back on the output of “kubectl get pods” above, notice that only one container running of one desired container on each pods. It means, there is no container except the microservice itself. In this step, we will inject all of them a sidecar container named “envoy proxy” on each pods. Here is the way :</p><ul><li>Inject a label <strong><em>istio-injection=enabled</em></strong> on its namespace. In this case, I use default namespace to deploy the apps.</li></ul><pre>kubectl label namespace default istio-injection=enabled</pre><p>Then check the pods status :</p><pre>kubectl get pods</pre><pre>output :</pre><pre>NAME                                     READY   STATUS             RESTARTS   AGE<br>adservice-75f6d84ddd-bbxzk               1/1     Running            0          5m21s<br>cartservice-75d66997cf-2f7bq             1/1     Running            1          5m22s<br>checkoutservice-855cd595b4-f8mrr         1/1     Running            0          5m22s<br>currencyservice-5b74f955c4-5jfcv         1/1     Running            0          5m21s<br>emailservice-95cc959f8-thrdz             1/1     Running            0          5m22s<br>frontend-79c8999fb6-cnkk6                1/1     Running            0          5m22s<br>loadgenerator-589648f87f-pvtfn           1/1     Running            0          5m22s<br>paymentservice-7d679d5b98-wkgsz          1/1     Running            0          5m22s<br>productcatalogservice-5f7d6665c6-2gpm7   1/1     Running            0          5m22s<br>recommendationservice-7569586f96-ndslt   1/1     Running<strong>            </strong>4          5m22s<br>redis-cart-5b569cd47-8bwhs               1/1     Running            0          5m21s<br>shippingservice-749b654bb4-7d9l7         1/1     Running            0          5m21s</pre><p>Nothing has changed, hasn’t it? It’s normal because restarting the pods is necessary to apply the latest configuration. We can delete the pods one by one but it will take more times, however we can delete all of the resources (deployment, pods, service, etc) only by using a single way :</p><pre>kubectl delete -f kubernetes-manifest.yaml</pre><p>Wait until all of them is completely deleted. Then, redeploy :</p><pre>kubectl apply -f kubernetes-manifest.yaml</pre><p>Shortly afterwards, it will show a bunch of pods starting to initialize and run as well. Wait until all of them on running status.</p><pre>kubectl get pods</pre><pre>output :</pre><pre>NAME                                     READY   STATUS    RESTARTS   AGE<br>adservice-75f6d84ddd-9jkv8               2/2     Running   0          19m<br>cartservice-75d66997cf-jg8qc             2/2     Running   5          19m<br>checkoutservice-855cd595b4-94969         2/2     Running   0          19m<br>currencyservice-5b74f955c4-77z7m         2/2     Running   0          19m<br>emailservice-95cc959f8-jp59c             2/2     Running   0          19m<br>frontend-79c8999fb6-nkfqd                2/2     Running   0          19m<br>loadgenerator-589648f87f-47kf4           2/2     Running   0          19m<br>paymentservice-7d679d5b98-dswl4          2/2     Running   0          19m<br>productcatalogservice-5f7d6665c6-5dlpc   2/2     Running   0          19m<br>recommendationservice-7569586f96-fzfpj   2/2     Running   0          19m<br>redis-cart-5b569cd47-vq7qc               2/2     Running   0          19m<br>shippingservice-749b654bb4-6xczm         2/2     Running   0          19m</pre><p>As we look at the output above, there are 2 containers running in each pods. 1 container is the microservice itself and 1 container is envoy proxy.</p><p>Right here, we have done all of the steps to get istio involved on our microservice apps. But now, is it finished? Definitely not. Precisely it’s the most interesting part (for me) to make istio visualized. When it comes to visualizing our service mesh into interesting graph and mapping, Kiali comes into play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uo7uMHWFAwEXyOECW7hTsA.png" /></figure><p>For additional information, we can configure istio to integrate with some other tools which has certain functionality that might be fit our needs. In this case I deploy all of the tools but only focus on Kiali.</p><p>It’s time to deploy Kiali ! Before that, let’s check the existing pods that run on istio-system namespace</p><pre>kubectl get pods -n istio-system</pre><pre>output :</pre><pre>NAME                                    READY   STATUS    RESTARTS   AGE<br>istio-ingressgateway-66644ff9c8-nngfb   1/1     Running   0          1h<br>istiod-866c5d9599-wz6k5                 1/1     Running   0          1h</pre><p>There are only 2 pods running.</p><pre>kubectl apply -f istio-1.9.0/samples/addons/</pre><pre>ooutput :</pre><pre>serviceaccount/grafana created<br>configmap/grafana created<br>service/grafana created<br>deployment.apps/grafana configured<br>configmap/istio-grafana-dashboards configured<br>configmap/istio-services-grafana-dashboards configured<br>deployment.apps/jaeger created<br>service/tracing created<br>service/zipkin created<br>service/jaeger-collector created<br>Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition<br>customresourcedefinition.apiextensions.k8s.io/monitoringdashboards.monitoring.kiali.io created<br>serviceaccount/kiali created<br>configmap/kiali created<br>clusterrole.rbac.authorization.k8s.io/kiali-viewer created<br>clusterrole.rbac.authorization.k8s.io/kiali created<br>clusterrolebinding.rbac.authorization.k8s.io/kiali created<br>role.rbac.authorization.k8s.io/kiali-controlplane created<br>rolebinding.rbac.authorization.k8s.io/kiali-controlplane created<br>service/kiali created<br>deployment.apps/kiali created<br>monitoringdashboard.monitoring.kiali.io/envoy created<br>monitoringdashboard.monitoring.kiali.io/go created<br>monitoringdashboard.monitoring.kiali.io/kiali created<br>monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm-pool created<br>monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm created<br>monitoringdashboard.monitoring.kiali.io/micrometer-1.1-jvm created<br>monitoringdashboard.monitoring.kiali.io/microprofile-1.1 created<br>monitoringdashboard.monitoring.kiali.io/microprofile-x.y created<br>monitoringdashboard.monitoring.kiali.io/nodejs created<br>monitoringdashboard.monitoring.kiali.io/quarkus created<br>monitoringdashboard.monitoring.kiali.io/springboot-jvm-pool created<br>monitoringdashboard.monitoring.kiali.io/springboot-jvm created<br>monitoringdashboard.monitoring.kiali.io/springboot-tomcat created<br>monitoringdashboard.monitoring.kiali.io/thorntail created<br>monitoringdashboard.monitoring.kiali.io/tomcat created<br>monitoringdashboard.monitoring.kiali.io/vertx-client created<br>monitoringdashboard.monitoring.kiali.io/vertx-eventbus created<br>monitoringdashboard.monitoring.kiali.io/vertx-jvm created<br>monitoringdashboard.monitoring.kiali.io/vertx-pool created<br>monitoringdashboard.monitoring.kiali.io/vertx-server created<br>serviceaccount/prometheus created<br>configmap/prometheus created<br>clusterrole.rbac.authorization.k8s.io/prometheus created<br>clusterrolebinding.rbac.authorization.k8s.io/prometheus created<br>service/prometheus created<br>deployment.apps/prometheus created</pre><p>Afterwards, let’s check the pods running on istio-system :</p><pre>kubectl get pods -n istio-system</pre><pre>output :</pre><pre>NAME                                    READY   STATUS    RESTARTS   AGE<br>grafana-7bdcf77687-lnwfg                1/1     Running   0          100s<br>istio-ingressgateway-66644ff9c8-nngfb   1/1     Running   0          10h<br>istiod-866c5d9599-wz6k5                 1/1     Running   0          10h<br>jaeger-5c7c5c8d87-bwxkg                 1/1     Running   0          100s<br>kiali-84db5dd45-j97qf                   1/1     Running   0          99s<br>prometheus-f5f544b59-2bndk              2/2     Running   0          99s</pre><p>Finally! We are on the last part of this labs now. Let’s access Kiali dashboard right away !</p><p>For information, I run this machine on proxmox and not directly on my own laptop, so giving the <strong><em>address</em></strong> parameter is necessary to make it accessible from the inbound traffic because the default value of <strong><em>address</em></strong> paramater is localhost.</p><pre>istioctl dashboard <strong>--address=0.0.0.0</strong> --browser=false kiali</pre><pre>output :</pre><pre>skipping opening a browser</pre><p>Anyway we have an alternative way to access Kiali only by using port-forward provided by <strong><em>kubectl</em></strong> as well</p><pre>kubectl port-forward --address=0.0.0.0 service/kiali -n istio-system 20001</pre><p>Move to browser to access the Kiali dashboard. If it works, it will appear like this picture below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mW00YDoH6lFuF80PD1Vw7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0VZD5gQanfHj2sdynGxFQ.png" /></figure><p>If this display doesn’t appear, it might be firewall block the traffic or any other possibilities but the common root cause is on firewall. So make sure we have allowed the inbound and outbound traffic which fits our needs or if it is only for learning purposes, stop and disable firewall is better.</p><p>Anyway that’s all I can convey a bit about this topic. I hope it will help us to understand service mesh and how to start the labs as well. If there is any mistakes from me or even have some topics to discuss about, I’m so pleased to know it :) Thank you!</p><p>Ref : <a href="https://istio.io/latest/docs/setup/getting-started/#download">https://istio.io/latest/docs/setup/getting-started/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da99d60ba415" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Labs Part 3: Integrate Jenkins with Openshift]]></title>
            <link>https://islamifauzi.medium.com/ci-cd-labs-part-3-integrate-jenkins-with-openshift-aae7e4f9164d?source=rss-6e7147fa40b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/aae7e4f9164d</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[openshift]]></category>
            <dc:creator><![CDATA[Muhammad Fauzi Islami]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 08:18:32 GMT</pubDate>
            <atom:updated>2021-03-26T09:10:07.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LkukheGqh7-wdh_SXPq2eQ.png" /></figure><p>In this part 3 CI / CD lab the author will document how to integrate Jenkins with the OpenShift.</p><p>What should be prepared :</p><p>- 1 VM Jenkins<br>Spec:<br>OS: Centos 7.9 (optional)<br>• RAM: 16GB (this will be used until labs finish)<br>• CPU: 4vCPU<br>• HDD: 100GB<br>• Internet connection</p><ul><li>1 VM CRC (CodeReady Container) Mini OpenShift<br>Spec:<br>OS: Centos 7.9 (optional)<br>• RAM: 16GB (this will be used until labs finish)<br>• CPU: 4vCPU<br>• HDD: 100GB<br>• Internet connection</li></ul><p>Inside the VM is installed:</p><p><strong>Jenkins (run as service)</strong><br>- Openjdk1.8<br>- Maven 3.6.3<br>- Docker client<br>- Git<br>- IP Address = 192.168.1.116:8080</p><p><strong>CodeReady Container</strong><br>- IP Address = 192.168.1.114</p><p><strong>OpenShift Configurations</strong></p><p>In this lab the author uses a CRC (CodeReady Container) which is a lightweight version of OpenShift and is only for development needs. However, the resources that will be used will be the same as production-ready OpenShift. For crc installation, see the official documentation link here <a href="https://code-ready.github.io/crc/">https://code-ready.github.io/crc/</a></p><p>First, log into the cluster by using a user who has the cluster-admin role. Here I used a virtual user who has been generated during the CRC installation process, namely kubeadmin.</p><pre><strong>[oji@crc ~]$ oc login -u kubeadmin -p D4tTL-hJYdy-qe36Y-okTwh https://api.crc.testing:6443</strong></pre><pre>Login successful.</pre><pre>You have access to 61 projects, the list has been suppressed. You can list all projects with &#39; projects&#39;</pre><pre>Using project &quot;default&quot;.</pre><pre><strong>[oji@crc ~]$ oc whoami<br></strong>kube:admin</pre><p>After successfully logging in, it’s time to create projects. The projects that will be made are dev (development), sim (simulation), and prod (production).</p><pre><strong>[oji@crc ~]$ oc new-project dev</strong></pre><pre><strong>[oji@crc ~]$ oc new-project sim</strong></pre><pre><strong>[oji@crc ~]$ oc new-project prod</strong></pre><p>Then create a service account in each of these projects for Jenkins to use in order to manage the project.</p><pre><strong>[oji@crc ~]$ oc create sa jenkins -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc create sa jenkins -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc create sa jenkins -n prod</strong></pre><p>Then give a role to the service account that has been created in each of these projects with role <strong>edit </strong>so that Jenkins can create, delete, and modify any resources in its project.</p><pre><strong>[oji@crc ~]$ oc policy add-role-to-user edit system:serviceaccount:dev:jenkins -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc policy add-role-to-user edit system:serviceaccount:sim:jenkins -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc policy add-role-to-user edit system:serviceaccount:prod:jenkins -n prod</strong></pre><pre><strong>[oji@crc ~]$ oc policy add-role-to-group system:image-puller system:serviceaccounts:dev -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc policy add-role-to-group system:image-puller system:serviceaccounts:sim -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc policy add-role-to-group system:image-puller system:serviceaccounts:prod -n prod</strong></pre><p>Now the last step from the openshift side is to create credentials from the image registry for each project. Here I used nexus which in part 1 has been configured to save the image. However, for this part 3 lab it is not yet used, it will be used on the last lab. It is the implementation of full CI / CD.</p><pre><strong>[oji@crc ~]$ oc create secret docker-registry nexus-registry --docker-server=nexus-registry.lab.example.com:5000 --docker-username=admin --docker-password=admin -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc create secret docker-registry nexus-registry --docker-server=nexus-registry.lab.example.com:5000 --docker-username=admin --docker-password=admin -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc create secret docker-registry nexus-registry --docker-server=nexus-registry.lab.example.com:5000 --docker-username=admin --docker-password=admin -n prod</strong></pre><pre><strong>[oji@crc ~]$ oc secrets link default nexus-registry –for=pull -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc secrets link default nexus-registry –for=pull -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc secrets link default nexus-registry –for=pull -n prod</strong></pre><pre><strong>oji@crc ~]$ oc secrets link builder nexus-registry -n dev</strong></pre><pre><strong>oji@crc ~]$ oc secrets link builder nexus-registry -n sim</strong></pre><pre><strong>oji@crc ~]$ oc secrets link builder nexus-registry -n prod</strong></pre><p><strong>Jenkins</strong></p><p>First, Login as an admin to Jenkins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vaLImsUarCKavH7gqg3BA.png" /></figure><p>Install the required plugins on the <strong>Manage Jenkins menu</strong> -&gt; <strong>Manage Plugins</strong> -&gt; <strong>[TAB] Available</strong>. Then install the plugin below:<br>- OpenShift Login Plugin<br>- OpenShift Client Jenkins Plugin</p><p>Then select <strong><em>Install without restarting</em></strong></p><p>Now I will create a credential in jenkins using the token in the service account that was created in openshift. To view these tokens you can use the command below:</p><pre><strong>[oji@crc ~]$ oc sa get-token jenkins -n dev</strong></pre><pre><strong>[oji@crc ~]$ oc sa get-token jenkins -n sim</strong></pre><pre><strong>[oji@crc ~]$ oc sa get-token jenkins -n prod</strong></pre><p>Perintah di atas akan menampilkan token. Selanjutnya <em>copy-paste</em> token tersebut untuk ditambahkan pada credential jenkins.</p><p><strong>Credential ocp-dev</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*voHkcNobj0gHqZPFb6fpjg.png" /></figure><p><strong>Credential ocp-sim</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*gHRcVrNSyjlzHnTSj34HiA.png" /></figure><p><strong>Credential ocp-prod</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*K_zeyyrBLJIldy03iZBObQ.png" /></figure><p>Next, I’ll integrate jenkins to bitbucket by going to the <strong>Manage Jenkins</strong> menu -&gt; <strong>Configure System</strong> -&gt; <strong>OpenShift Client Plugin</strong>. Provide the cluster name for openshift and the URL for the apiserver from openshift to integrate. Then for the token enter the token that was previously created. In this lab, because I’m using CRC, the environment will be simulated only with different projects but in the same cluster. At the time of its implementation, the best practice is to separate each environment with a different cluster.</p><p>Then to test the connection, I made a job containing a pipeline to check the availability of each cluster.</p><p>Select <strong>New Item</strong> -&gt; <strong>Pipeline</strong>, then name the job. Then the Pipeline field can be adjusted as shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*-BmcITwhw_mTPxnFDJDiew.png" /></figure><p>Pipeline :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ed86b61e562b13450cda2241b4ab75c/href">https://medium.com/media/9ed86b61e562b13450cda2241b4ab75c/href</a></iframe><p>Then save.</p><p>Then do a build. It can be seen that the pipeline was going well and successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*3F8bJGdYcjbBpZKcAoAxHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*tgpjTKJm3rZFGY8ZtkK91Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aae7e4f9164d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Labs Part 2 : Integrate Jenkins with Bitbucket Server]]></title>
            <link>https://islamifauzi.medium.com/ci-cd-labs-part-2-integrate-jenkins-with-bitbucket-server-ab1e5fdb01bf?source=rss-6e7147fa40b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab1e5fdb01bf</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[bitbucket]]></category>
            <dc:creator><![CDATA[Muhammad Fauzi Islami]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 08:59:01 GMT</pubDate>
            <atom:updated>2021-03-05T08:59:29.610Z</atom:updated>
            <content:encoded><![CDATA[<h3>CI/CD Labs Part 2 : Integrate Jenkins with Bitbucket Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6dVI5_7tXxMbNsYUExdSCQ.png" /></figure><p>In this part 2 of the CI / CD labs, I will document how to do Jenkins integration with the Bitbucket server (not the cloud).</p><p>What should be prepared :</p><p>1 VM (Jenkins + Bitbucket Server)<br>Specifications :<br>• OS Centos 7.9 (optional)<br>• RAM: 16GB (this will be used until labs get finished)<br>• CPU: 4vCPU<br>• HDD: 100GB<br>• Internet connection</p><p>Inside the VM are installed as follows :</p><p><strong>Jenkins (run as a service)</strong><br>- Openjdk1.8<br>- Maven 3.6.3<br>- Docker client<br>- Git<br>- IP address = 192.168.1.116:8080</p><p><strong>Bitbucket Server (run as a container)</strong><br>- IP address = 192.168.1.116:7990</p><p><strong>Bitbucket Server Configurations</strong></p><p>Bitbucket Server is a git-based source code management which is self-hosted. It’s different with Bitbucket.org that we may access it publicly, but they still have the same main functionality, that is as a source code repository.</p><p>Here are the configuration steps:</p><ul><li>Login to Bitbucket as an admin, then create a Personal Access Token</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BisZNhUQ2QAGlmGDE9ExNA.png" /></figure><ul><li>The following is a token that has been created (it must be noted because it can’t be seen again after the continue button is pressed)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cso0Bl5FTxpgRoxK8_v1zA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkFrz5eslSltzxc0vrWVbA.png" /></figure><ul><li>Then create a new project</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0sraiJ3wpCI_sul-AEO89w.png" /></figure><ul><li>This is a project that was created:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*399ZiKnn0gbPvA37WM70BA.png" /></figure><p>Furthermore, from this project we create a new repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZVKctSCrZFVZ2XYtqiPIw.png" /></figure><p>The following is the contents of the new repository which has been filled in by the files used in the previous lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80OlKUBj1jImwIj94hetTQ.png" /></figure><p>The final step is to create a webhook in the repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ciNq69MbFZ22y6hMNcUgiw.png" /></figure><p><strong>Jenkins Configurations</strong></p><p>Here are the configuration steps:</p><ul><li>Log in first as an admin to Jenkins</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Tpj1gfjf12AKwWRvSfi0g.png" /></figure><p>Install the required plugins on the <strong>Manage Jenkins</strong> menu -&gt; <strong>Manage Plugins</strong> -&gt; [TAB] <strong>Available</strong>. Then install the plugin below:<br>- Bitbucket Server Integration</p><p>Then select <strong>Install without restart</strong></p><p>Now I will create a credential in Jenkins using the token previously generated in Bitbucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YM3Eb0x8vec5pHKswwQfkg.png" /></figure><p>Then it’s time to integrate jenkins to bitbucket by going to the <strong>Manage Jenkins menu</strong> -&gt; <strong>Configure System</strong> -&gt; <strong>Bitbucket Server Integration</strong>. Provide an instance name for the bitbucket and the URL of the bitbucket server to integrate to. Then for the token enter the token that was previously created. Then to make sure Jenkins can <strong><em>handshake </em></strong>the Bitbucket, click the test connection button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-t1WZKWBI3wqhyE1d_tJqw.png" /></figure><p>Then the final step is to create a job from a pipeline defined in the Jenkinsfile which is stored in the Bitbucket repository that was created in the previous step.</p><p>Select <strong>New Item</strong> -&gt; <strong>Pipeline</strong>, then name the job. Then in the <strong>Build Triggers </strong>field, do a check-list on the <strong>Bitbucket Server trigger build after push</strong> checkbox. And the <strong>Pipeline </strong>field can be adjusted as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0ypMy5XpXoLbBtQSpJvRA.png" /></figure><p>Then save it.</p><p>Then do the build (either by making changes to the repository or by doing a manual build). It can be seen that the pipeline was going well and being successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkZTETaFSsWLV6DUuqCaAg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab1e5fdb01bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Labs Part 1 : Integrate Jenkins with Nexus Repository OSS]]></title>
            <link>https://islamifauzi.medium.com/ci-cd-labs-part-1-integrate-jenkins-with-nexus-repository-oss-6826cb5f708c?source=rss-6e7147fa40b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6826cb5f708c</guid>
            <category><![CDATA[cicd-pipeline]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[nexus-repository-manager]]></category>
            <dc:creator><![CDATA[Muhammad Fauzi Islami]]></dc:creator>
            <pubDate>Wed, 03 Mar 2021 04:22:00 GMT</pubDate>
            <atom:updated>2021-03-03T04:51:25.647Z</atom:updated>
            <content:encoded><![CDATA[<h3>CI/CD Labs Part 1 : Integrate Jenkins with Nexus Repository OSS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*hiFHEr_3BHqzVjHZCddIgQ.png" /></figure><p>This is the first lab of lab series to learn CI/CD. In this lab, I will only focus on documenting the implementations step by step and not on the installation. Maybe on another occasion, I may also include how to install each of the tools used in this lab.</p><p>The following are some of the parts of this series :<br>1. Integrate Jenkins with Nexus Repository OSS<br>2. Integrate Jenkins with Bitbucket<br>3. Integrate Jenkins with OpenShift<br>4. Integrate Jenkins with Jira<br>5. Full CI / CD Pipeline</p><p><strong><em>*Note : These labs don’t involve any tests.</em></strong></p><p>What should be prepared :</p><p>1 VM (Jenkins + Nexus)<br>Specifications :<br>• OS Centos 7.9 (optional)<br>• RAM: 16GB (this will be used until labs get finished)<br>• CPU: 4vCPU<br>• HDD: 100GB<br>• Internet connection</p><p>Inside the VM are installed as follows :</p><p><strong>Jenkins (run as a service)</strong><br>- Openjdk1.8<br>- Maven 3.6.3<br>- Docker client<br>- Git<br>- IP address = 192.168.1.116:8080</p><p><strong>Nexus (run as a container)</strong><br>- IP address = 192.168.1.116:8081</p><p><strong>Nexus Configurations</strong></p><p>Nexus is an open source repository that supports storing artifacts and docker images.</p><p>Here are the configuration steps:</p><ul><li>Login to nexus as admin, then create one user.</li></ul><p>Here the user is named jenkins-user, don’t forget to grant roles as admin as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*c38gUybSYGP6xcA3pHKQ8Q.png" /></figure><ul><li>Create a image registry with the specifications as shown below</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*DWKdcfcJ0mzziRD40hywNg.png" /></figure><ul><li>Next, create an artifactory with specifications like the picture below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*wfK4vvGVu6F6BKcjRWAYuQ.png" /></figure><p>The configuration from the nexus side is completed. In essence, we only need to create a user that will be used by Jenkins, 1 image registry and 1 artifactory.</p><p><strong>Jenkins Configurations</strong></p><p>Jenkins is a powerful open source CI / CD tool because it is supported by many plugins so it will be easier to integrate with any third-party tools.</p><p>Here are the configuration steps:</p><ul><li>Log in first as an admin to Jenkins</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*UcF2EwN4lYPpLB9rZdj_eA.png" /></figure><p>Install the required plugins on the <strong>Manage Jenkins</strong> menu -&gt; <strong>Manage Plugins</strong> -&gt; [TAB] <strong>Available</strong>. Then install the plugin below:<br>- Nexus Artifact Uploader<br>- Docker Pipeline</p><p>Then select <strong>Install without restarting</strong></p><p>And configure the tools that will be used :</p><ul><li>Maven</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*R0U-iBUCWYGh526_PVz9Jw.png" /></figure><ul><li>Openjdk</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*TGlKQ7K46DxYngkx39ZqCA.png" /></figure><ul><li>Docker Client</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*5xXZ2xurbReDso3diVLH-A.png" /></figure><ul><li>Git</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*5xXZ2xurbReDso3diVLH-A.png" /></figure><p>Then save it.</p><p>Next, we will immediately create a pipeline that will build source code and image to be stored in nexus.</p><p>Then we need to create a credential for nexus on jenkins so that jenkins can interact with nexus. Use the username and password that was created earlier on nexus, namely <strong>jenkins-user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*pW2eGldbyN4en3C1-uQAMg.png" /></figure><p>Then the final step is to create a job in which there is a pipeline to build the source code into an artifact and an image which will later be stored on nexus.</p><p>Select <strong>New Item</strong> -&gt; <strong>Pipeline</strong>. Here I create a pipeline in a Jenkinsfile which is stored on my Github repo( <a href="https://github.com/fauzislami/jenkins-nexus-integration.git"><em>https://github.com/fauzislami/jenkins-nexus-integration.git</em></a><em> </em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*kd6C1m5qNoPKHFaOAeN-2g.png" /></figure><p>Then save it.</p><p>Then trigger the build manually. Here there are 3 previous builds that failed and can be ignored, because those were still an adjustment stage LOL. However, in the next build, it has succeeded to push artifacts and images</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*bk8_Lden0Qx7ts6u-Jhj3Q.png" /></figure><p>This is an artifact that has been successfully stored in nexus :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*WJA24kNGrnU2PA6sAuxKkg.png" /></figure><p>And this is an image that has been successfully stored to nexus :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*5qMwVMCqVBer8M6qgyll7Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6826cb5f708c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating K8S Cluster Installation with Kubespray]]></title>
            <link>https://islamifauzi.medium.com/automating-k8s-cluster-installation-with-kubespray-44bc85a5c7e?source=rss-6e7147fa40b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/44bc85a5c7e</guid>
            <category><![CDATA[kubespray]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Muhammad Fauzi Islami]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 12:43:57 GMT</pubDate>
            <atom:updated>2021-01-18T13:45:46.803Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2B5iNF0UtHeKru7I-FwqKA.png" /></figure><p>There are various ways to perform a kubernetes installation. If you look at the environment in which kubernetes will be installed on, you have options that can be done, namely:</p><p><strong>Learning purposes :</strong></p><ul><li><em>Kind </em>tools ( Kubernetes In Docker )</li><li><em>Minikube</em></li></ul><p><strong>Production purposes :</strong></p><ul><li>Bootstrapping K8S with <em>kubeadm</em></li><li>Installing K8S with <em>kubespray</em></li><li>Installing K8S with <em>kops</em></li></ul><p>In this opportunity, I will do the installation of a kubernetes cluster using kubespray. Kubespray itself is a way to install Kubernetes cluster by automating it using ansible playbook.</p><p>Kubespray can be implemented in a variety of environments. Starting from the baremetal environment, virtualization and cloud. Until now, several supported cloud providers are OpenStack, AWS, Google Cloud, and Azure. Meanwhile, the official documentation for virtualization is VMware VSphere. But at this time, I will do it in a baremetal environment, where I have prepared 3 VMs first, namely for master there are 2 VMs and worker there is only 1 VM. With VM specifications as follows:</p><ul><li>OS : Centos 7.8</li><li>CPU : 2vCPU</li><li>RAM : 8GB</li><li>Disk : 100GB</li></ul><p>List of VMs :</p><ul><li>Master-1 : 192.168.1.119</li><li>Master-2 : 192.168.1.120</li><li>Worker : 192.168.1.122</li></ul><p>Of course this is not recommended for a production environment in view of the above specifications and there is also no load balancer that manages the load traffic on the cluster.</p><p>Okay, let’s just get into the execution stage! Bismillah</p><p><em>Requirements:</em></p><ul><li>Internet access</li><li>The SSH public key from the ansible host is copied to all nodes</li><li>Tools installed on ansible host:<br>- Ansible v2.9<br>- Jinja 2.11 (or newer)<br>- Git<br>- Python3<br>- Kubectl</li></ul><p><strong>Step 1: SSH Passwordless</strong></p><p>Create an SSH Key</p><pre>root@fauzislami:~# ssh-keygen<br>Generating public/private rsa key pair.<br>Enter file in which to save the key (/root/.ssh/id_rsa):<br>Enter passphrase (empty for no passphrase):<br>Enter same passphrase again:<br>Your identification has been saved in /root/.ssh/id_rsa<br>Your public key has been saved in /root/.ssh/id_rsa.pub<br>The key fingerprint is:<br>SHA256:DSt3Ryf1tdxAoi7Hl1vSBXYiH+rjM8r3sCxGjsrHbmo root@LAPTOP-AGEMNL1C<br>The key&#39;s randomart image is:<br>+---[RSA 3072]----+<br>|            o.O o|<br>|           . B.B+|<br>|        . . + oo+|<br>|         * o = . |<br>|      . S * B o  |<br>|       o +.+ =   |<br>|       . +  *    |<br>|     .E =.+o.=   |<br>|     .+*..ooo..  |<br>+----[SHA256]-----+<br>root@fauzislami:~#<br>root@fauzislami:~# cat .ssh/id_rsa.pub<br>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3zM+kq4oo3GyEU363R7y8dbqD0CWsFG3cUmwkzaU3eWNN8FTLu68UZjHCh5D9i/yaS7kcn0UsmRTSL4U5Eb+JZFGfRVgl5CGRv3ljKi80LfS5KZV2pqDPbq49jLHFeq04a3y8FcyQ5crHvfoL00mMmL6mgFVYcM6BdhvHafyfKhZGuNqqa4ImQsWejcn1lyMhy/bbMBDTYwQAdI/9csWkEUO4V7LQukQk+NWszOOS3q38A1mGN7uROjo9/w1lg4ITX03UonzNjv2zOCHozrC4DeGsdw0m8tSNjjtrOIGtQ9sxFkNU0MoQacFR/orF9cWzZonk0IrFtMZoqf+Pan+1xpwzhA+QuRRceYE0VAv62shlI+ni6PR5xFRXWKIJOw6haMga0UfKi3/KLEHRtY3t+Ej73As7HdwjzgLZm6PfkXhmAbIp/dzeXNJxwXlyztjzexOy9dIGYxxEC1LDBkbwW8lE5aMvZjWv7s/ITKbMqgRx7dT6lWZXyRPIJ+mG9LM= root@LAPTOP-AGEMNL1C</pre><p>Copy the public key from the ansible host to each nodes</p><pre>                          ###Master-1<br><br>root@fauzislami:~# ssh-copy-id root@192.168.1.119<br>/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: &quot;/root/.ssh/id_rsa.pub&quot;<br>The authenticity of host &#39;master-1 (192.168.1.119)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:WD3MM3C1C+yfAo55EfJusx0rIcb+Q0BP4h1DutLsUxM.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed<br>/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys<br>root@master-1&#39;s password:<br><br>Number of key(s) added: 1<br><br>Now try logging into the machine, with:   &quot;ssh &#39;root@192.168.1.119&#39;&quot;<br>and check to make sure that only the key(s) you wanted were added.<br><br><br>                            ###Master-2<br><br>root@fauzislami:~# ssh-copy-id root@192.168.1.20<br>/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: &quot;/root/.ssh/id_rsa.pub&quot;<br>The authenticity of host &#39;master-2 (192.168.1.120)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:Ym2FizkXGlO+ESIPNvEhI0SSaFr/9NuAB05eLr/NAus.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed<br>/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys<br>root@master-2&#39;s password:<br>bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br>/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br>sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br><br>Number of key(s) added: 1<br><br>Now try logging into the machine, with:   &quot;ssh &#39;root@192.168.1.120&#39;&quot;<br>and check to make sure that only the key(s) you wanted were added.<br><br><br>                              ###Worker<br><br>root@fauzislami:~# ssh-copy-id root@192.168.1.122<br>/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: &quot;/root/.ssh/id_rsa.pub&quot;<br>The authenticity of host &#39;worker (192.168.1.122)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:MGVRcMxTBzixZPMlGk9NPEM0izTxqQtmEHBm3Ksh/hg.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed<br>/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys<br>root@worker&#39;s password:<br>bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br>/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br>sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)<br><br>Number of key(s) added: 1<br><br>Now try logging into the machine, with:   &quot;ssh &#39;root@192.168.1.122&#39;&quot;<br>and check to make sure that only the key(s) you wanted were added.</pre><p>Test login to each nodes and make sure you can log in without having to enter a password (passwordless)</p><pre>                         ###Master-1<br><br>root@fauzislami:~# ssh root@192.168.1.119<br>Last login: Thu Jan  7 14:16:14 2021<br>[root@localhost ~]#<br><br>                         ###Master-2<br><br>root@fauzislami:~# ssh root@192.168.1.120<br>Last login: Thu Jan  7 14:16:30 2021<br>[root@localhost ~]#<br><br>                         ###Worker<br><br>root@fauzislami:~# ssh root@192.168.1.122<br>Last login: Thu Jan  7 14:17:05 2021<br>[root@localhost ~]#</pre><p><strong>Step 2: Installation requirements</strong></p><p>Do a <em>git clone</em></p><pre>root@fauzislami:~# git clone https://github.com/fauzislami/kubespray-deployment.git<br><br>root@fauzislami:~# cd kubespray<br>root@fauzislami:~/kubespray#</pre><blockquote>The original Project : <a href="https://github.com/kubernetes-sigs/kubespray.git">https://github.com/kubernetes-sigs/kubespray.git</a></blockquote><p>If <em>pip3 </em>is not available, you can install it using the command below</p><pre>root@fauzislami:~/kubespray# apt install python3-pip -y</pre><p>Requirement installation</p><pre>root@fauzislami:~/kubespray# pip3 install -r requirements.txt</pre><p>Copy and update existing sample inventory</p><pre>root@fauzislami:~/kubespray# cp -rfp inventory/sample inventory/mycluster</pre><pre>### env var IPS contains IP nodes<br><br>root@fauzislami:~/kubespray# declare -a IPS=(192.168.1.119 192.168.1.120 192.168.1.122)</pre><pre>CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}</pre><p>Edit inventory</p><pre>###Here I choose CRI for the container runtime (default: docker)<br>root@fauzislami:~/kubespray# vim inventory/mycluster/group_vars/k8s-cluster/k8s-cluster.yml<br><br>//<br>container_manager: crio<br>//<br><br><br><br>###Here I change the prefix of node naming (default: node)<br>root@fauzislami:~/kubespray# vim inventory/mycluster/hosts.yaml<br><br>//<br>all:<br>  hosts:<br>    master-1:<br>      ansible_host: 192.168.1.119<br>      ip: 192.168.1.119<br>      access_ip: 192.168.1.119<br>    master-2:<br>      ansible_host: 192.168.1.120<br>      ip: 192.168.1.120<br>      access_ip: 192.168.1.120<br>    worker:<br>      ansible_host: 192.168.1.122<br>      ip: 192.168.1.122<br>      access_ip: 192.168.1.122<br>  children:<br>    kube-master:<br>      hosts:<br>        master-1:<br>        master-2:<br>    kube-node:<br>      hosts:<br>        master-1:<br>        master-2:<br>        worker:<br>    etcd:<br>      hosts:<br>        master-1:<br>        master-2:<br>        worker:<br>    k8s-cluster:<br>      children:<br>        kube-master:<br>        kube-node:<br>    calico-rr:<br>      hosts: {}<br>//</pre><blockquote>To reproduce the further things, such as changing the pod prefix, the version of the cluster to be installed, the name of the cluster, etc., I don’t do this in this lab.</blockquote><p><strong>Step 3: Installations</strong></p><p>This step is the final stage for installing kubernetes using kubespray, which is executing the ansible playbook.</p><pre>root@fauzislami:~/kubespray# ansible-playbook -i inventory/mycluster/hosts.yaml --user root cluster.yml<br><br>Output: <br><br>PLAY [localhost] *******************************************************************************************************************************************************************************************<br>Thursday 07 January 2021  15:05:04 +0700 (0:00:00.511)       0:00:00.512 ******<br><br>TASK [Check ansible version &gt;=2.8.0] ***********************************************************************************************************************************************************************<br>ok: [localhost] =&gt; {<br>    &quot;changed&quot;: false,<br>    &quot;msg&quot;: &quot;All assertions passed&quot;<br>}<br><br>...........<br>...........<br>...........<br><br>PLAY RECAP *************************************************************************************************************************************************************************************************<br>localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0<br>master-1                   : ok=595  changed=94   unreachable=0    failed=0    skipped=1068 rescued=0    ignored=0<br>master-2                   : ok=516  changed=84   unreachable=0    failed=0    skipped=918  rescued=0    ignored=0<br>worker                     : ok=436  changed=66   unreachable=0    failed=0    skipped=607  rescued=0    ignored=0<br><br>Thursday 07 January 2021  15:57:37 +0700 (0:00:00.084)       0:23:18.899 ******<br>===============================================================================<br>container-engine/cri-o : Install cri-o packages ---------------------------------------------------------------------------------------------------------------------------------------------------- 87.72s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 57.78s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 47.56s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 46.71s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 43.55s<br>etcd : Gen_certs | Write etcd master certs --------------------------------------------------------------------------------------------------------------------------------------------------------- 39.07s<br>etcd : Gen_certs | Write etcd master certs --------------------------------------------------------------------------------------------------------------------------------------------------------- 38.68s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 35.67s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 35.35s<br>kubernetes/master : Joining control plane node to the cluster. ------------------------------------------------------------------------------------------------------------------------------------- 30.43s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 27.58s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 26.47s<br>download : download_container | Download image if required ----------------------------------------------------------------------------------------------------------------------------------------- 23.80s<br>kubernetes/master : kubeadm | Initialize first master ---------------------------------------------------------------------------------------------------------------------------------------------- 21.49s<br>container-engine/crictl : download_file | Download item -------------------------------------------------------------------------------------------------------------------------------------------- 21.42s<br>Gather necessary facts ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 19.82s<br>etcd : Gen_certs | Gather etcd master certs -------------------------------------------------------------------------------------------------------------------------------------------------------- 19.77s<br>kubernetes/kubeadm : Join to cluster --------------------------------------------------------------------------------------------------------------------------------------------------------------- 19.47s<br>etcd : Gen_certs | Gather etcd master certs -------------------------------------------------------------------------------------------------------------------------------------------------------- 19.06s<br>kubernetes-apps/ansible : Kubernetes Apps | Lay Down CoreDNS Template ------------------------------------------------------------------------------------------------------------------------------ 17.82s</pre><p>Based on the output snippet above, the installation process will take about 23 minutes. The installation process will take longer depending on how many nodes will be made into one cluster and of course the internet connection. Here the installed kubernetes is version 1.19.6</p><p>Copy the certificate from one master to the host which will be used to manage the cluster. Here I still use ansible host.</p><pre>root@fauzislami:~/kubespray# scp root@master-2:/etc/kubernetes/admin.conf /root/.kube/config</pre><p>Testing</p><pre>root@fauzislami:~# kubectl get nodes<br>NAME       STATUS   ROLES    AGE    VERSION<br>master-1   Ready    master   121m   v1.19.6<br>master-2   Ready    master   120m   v1.19.6<br>worker     Ready    &lt;none&gt;   119m   v1.19.6<br><br>root@fauzislami:~# kubectl get ns<br>NAME              STATUS   AGE<br>default           Active   121m<br>kube-node-lease   Active   121m<br>kube-public       Active   121m<br>kube-system       Active   121m</pre><p>Thank you for reading this article and I hope it is useful. See ya!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44bc85a5c7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>