<?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"><channel><title><![CDATA[Write by Jesaya]]></title><description><![CDATA[Write by Jesaya]]></description><link>https://scriptum.jesaya.my.id</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 10:16:59 GMT</lastBuildDate><atom:link href="https://scriptum.jesaya.my.id/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setup Prometheus Server on Red Hat Enterprise Linux 8]]></title><description><![CDATA[Overview
Prometheus is an open-source and community-driven system monitoring and alerting. All metrics will be pulled, saved on a time-series database, and queried to display the metrics needed for monitoring. This article will show you how to set up...]]></description><link>https://scriptum.jesaya.my.id/setup-prometheus-server-on-red-hat-enterprise-linux-8</link><guid isPermaLink="true">https://scriptum.jesaya.my.id/setup-prometheus-server-on-red-hat-enterprise-linux-8</guid><category><![CDATA[Devops]]></category><category><![CDATA[#prometheus]]></category><category><![CDATA[monitoring]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[RHEL]]></category><dc:creator><![CDATA[Jesaya Fernando Napitupulu]]></dc:creator><pubDate>Wed, 28 Jun 2023 04:51:55 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-overview">Overview</h1>
<p>Prometheus is an open-source and community-driven system monitoring and alerting. All metrics will be pulled, saved on a time-series database, and queried to display the metrics needed for monitoring. This article will show you how to set up a Prometheus Server on RHEL 8 (or RHEL 8-based distributions such as Alma Linux, Rocky Linux, and CentOS Stream).</p>
<h1 id="heading-pre-requisites">Pre-requisites</h1>
<p>For this article, we just need one VM with:</p>
<ul>
<li><p>Registered and attached a subscription with Red Hat Enterprise Linux 8 licensed.</p>
</li>
<li><p>Internet access for downloading dependencies is needed.</p>
</li>
<li><p>Open access to port 9090 (default port for Prometheus).</p>
</li>
</ul>
<h1 id="heading-steps">Steps</h1>
<ol>
<li><p><strong>Configure SELinux</strong></p>
<blockquote>
<p>For your information, SELinux does not have a specific policy but you can use it along with SELinux enabled by following this article: <a target="_blank" href="https://blog.kubesimplify.com/installing-prometheus-with-selinux">Installing Prometheus with SELinux</a> and passing this section.</p>
</blockquote>
<p> The step below will edit the SELinux configuration file and set it to permissive. Moreover, for current boot session we need to set permissive.</p>
<pre><code class="lang-bash">  vim /etc/selinux/config
</code></pre>
<pre><code class="lang-bash"> <span class="hljs-comment"># This file controls the state of SELinux on the system.</span>
 <span class="hljs-comment"># SELINUX= can take one of these three values:</span>
 <span class="hljs-comment">#     enforcing - SELinux security policy is enforced.</span>
 <span class="hljs-comment">#     permissive - SELinux prints warnings instead of enforcing.</span>
 <span class="hljs-comment">#     disabled - No SELinux policy is loaded.</span>
 SELINUX=permissive
 <span class="hljs-comment"># SELINUXTYPE= can take one of these three values:</span>
 <span class="hljs-comment">#     targeted - Targeted processes are protected,</span>
 <span class="hljs-comment">#     minimum - Modification of targeted policy. Only selected processes are protected.</span>
 <span class="hljs-comment">#     mls - Multi Level Security protection.</span>
 SELINUXTYPE=targeted
</code></pre>
<pre><code class="lang-bash"> setenforce permissive
</code></pre>
</li>
<li><p><strong>Download and extract Prometheus dependency</strong></p>
<p> You can download freely from Prometheus’ GitHub release page and choose specific release version and environment. On this article, we using Prometheus 2.37.8 for Linux with AMD64 architecture.</p>
<pre><code class="lang-bash"> curl -L -o prometheus-2.37.8.linux-amd64.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.37.8/prometheus-2.37.8.linux-amd64.tar.gz
 tar -xvf prometheus-2.37.8.linux-amd64.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.37.8/prometheus-2.37.8.linux-amd64.tar.gz
</code></pre>
</li>
<li><p><strong>Setup Prometheus user and directory</strong></p>
<p> We need to create a user for the Prometheus SystemD service. Moreover, we need to set up the downloaded and extracted files related to Prometheus, such as <code>prometheus.yml</code> (the default Prometheus configuration file), <code>prometheus</code> (the main binary file for running the server), and <code>promtool</code> (the binary file for validating any configuration for Prometheus), with all file ownership granted to the Prometheus user.</p>
<pre><code class="lang-bash"> useradd --no-create-home --shell /sbin/nologin prometheus
 mkdir /etc/prometheus /var/lib/prometheus
 touch /etc/prometheus/web.yml
 mv prometheus-2.37.8.linux-amd64/prometheus.yml /etc/prometheus/
 mv prometheus-2.37.8.linux-amd64/prometheus /usr/<span class="hljs-built_in">local</span>/bin/
 mv prometheus-2.37.8.linux-amd64/promtool /usr/<span class="hljs-built_in">local</span>/bin/
 chown prometheus:prometheus -R /etc/prometheus/ /usr/<span class="hljs-built_in">local</span>/bin/prometheus /usr/<span class="hljs-built_in">local</span>/bin/promtool /var/lib/prometheus
</code></pre>
</li>
<li><p><strong>Configure basic authentication for Prometheus</strong></p>
<p> You may need to secure your Prometheus by adding an user and access Prometheus as pre-configured user and password. On Prometheus, all user credential will saved as a web config file and all password should be saved as Bcrypt hashes password. You can hash your password with Bcrypt using <a target="_blank" href="https://bcrypt-generator.com/">Bcrypt-Generator.com</a> site or follow this article: <a target="_blank" href="https://prometheus.io/docs/guides/basic-auth/">Basic auth</a>.</p>
<pre><code class="lang-bash"> vim /etc/prometheus/web.yml
</code></pre>
<pre><code class="lang-yaml"> <span class="hljs-attr">basic_auth_users:</span>
   <span class="hljs-attr">admin:</span> [<span class="hljs-string">Bcrypt-hashes-passowrd</span>]
</code></pre>
</li>
<li><p><strong>Configure Prometheus configuration</strong></p>
<p> This configuration will add credential configuration for scraping jobs from Prometheus server metrics.</p>
<pre><code class="lang-bash"> vim /etc/prometheus/prometheus.yml
</code></pre>
<pre><code class="lang-yaml"> <span class="hljs-comment"># my global config</span>
 <span class="hljs-attr">global:</span>
   <span class="hljs-attr">scrape_interval:</span> <span class="hljs-string">15s</span> <span class="hljs-comment"># Set the scrape interval to every 15 seconds. Default is every 1 minute.</span>
   <span class="hljs-attr">evaluation_interval:</span> <span class="hljs-string">15s</span> <span class="hljs-comment"># Evaluate rules every 15 seconds. The default is every 1 minute.</span>
   <span class="hljs-comment"># scrape_timeout is set to the global default (10s).</span>

 <span class="hljs-comment"># Alertmanager configuration</span>
 <span class="hljs-attr">alerting:</span>
   <span class="hljs-attr">alertmanagers:</span>
     <span class="hljs-bullet">-</span> <span class="hljs-attr">static_configs:</span>
         <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span>
           <span class="hljs-comment"># - alertmanager:9093</span>

 <span class="hljs-comment"># Load rules once and periodically evaluate them according to the global 'evaluation_interval'.</span>
 <span class="hljs-attr">rule_files:</span>
   <span class="hljs-comment"># - "first_rules.yml"</span>
   <span class="hljs-comment"># - "second_rules.yml"</span>

 <span class="hljs-comment"># A scrape configuration containing exactly one endpoint to scrape:</span>
 <span class="hljs-comment"># Here it's Prometheus itself.</span>
 <span class="hljs-attr">scrape_configs:</span>
   <span class="hljs-comment"># The job name is added as a label `job=&lt;job_name&gt;` to any timeseries scraped from this config.</span>
   <span class="hljs-bullet">-</span> <span class="hljs-attr">job_name:</span> <span class="hljs-string">"prometheus"</span>

     <span class="hljs-comment"># metrics_path defaults to '/metrics'</span>
     <span class="hljs-comment"># scheme defaults to 'http'.</span>

     <span class="hljs-attr">static_configs:</span>
       <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span> [<span class="hljs-string">"localhost:9090"</span>]
     <span class="hljs-attr">basic_auth:</span>
       <span class="hljs-attr">username:</span> <span class="hljs-string">"admin"</span>
       <span class="hljs-attr">password:</span> [<span class="hljs-string">Unhashes-password</span>]
</code></pre>
</li>
<li><p><strong>Setup Prometheus service</strong></p>
<p> Lastly, we should create a Prometheus’ service to run background. The prometheus service will enabled and run even the VM restarted.</p>
<pre><code class="lang-bash"> vim /etc/systemd/system/prometheus.service
</code></pre>
<pre><code class="lang-bash"> [Unit]
 Description=Prometheus
 Wants=network-online.target
 After=network-online.target

 [Service]
 User=prometheus
 Group=prometheus
 Type=simple
 ExecStart=/usr/<span class="hljs-built_in">local</span>/bin/prometheus \
 --config.file /etc/prometheus/prometheus.yml \
 --web.config.file /etc/prometheus/web.yml \
 --storage.tsdb.path /var/lib/prometheus/ \
 --web.console.templates=/etc/prometheus/consoles \
 --web.console.libraries=/etc/prometheus/console_libraries

 [Install]
 WantedBy=multi-user.target
</code></pre>
<pre><code class="lang-bash"> systemctl daemon-reload
 systemctl <span class="hljs-built_in">enable</span> --now prometheus
</code></pre>
<h1 id="heading-reference">Reference</h1>
<ul>
<li><p>Devopscube, “How To Install And Configure Prometheus Monitoring System On Linux,” <em>DevopsCube</em>, Oct. 21, 2020. <a target="_blank" href="https://devopscube.com/install-configure-prometheus-linux">https://devopscube.com/install-configure-prometheus-linux</a></p>
</li>
<li><p>J. Mutai, “How To Install Prometheus on RHEL 8 / CentOS 8,” <em>ComputingForGeeks</em>, Apr. 26, 2022. <a target="_blank" href="https://computingforgeeks.com/how-to-install-prometheus-on-rhel-8">https://computingforgeeks.com/how-to-install-prometheus-on-rhel-8</a></p>
</li>
<li><p>Leon, “Installing Prometheus with SELinux,” <em>Kubesimplify</em>, May 16, 2022. <a target="_blank" href="https://blog.kubesimplify.com/installing-prometheus-with-selinux">https://blog.kubesimplify.com/installing-prometheus-with-selinux</a></p>
</li>
<li><p>Prometheus, “Securing Prometheus API and UI Endpoints Using Basic Auth,” <em>Prometheus,</em> <a target="_blank" href="https://prometheus.io/docs/guides/basic-auth/">https://prometheus.io/docs/guides/basic-auth</a></p>
</li>
</ul>
</li>
</ol>
<blockquote>
<p>Revision:</p>
<p>28/06/2023 - 10:53 PM: Add step to configuring Prometheus.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Create a Simple Kubernetes Cluster with MicroK8s]]></title><description><![CDATA[Overview
Kubernetes is a container orchestration tool for managing containerized workloads and services. For creating a Kubernetes cluster, you should set up a container runtime and other configurations to initialize it. With MicroK8s, you can initia...]]></description><link>https://scriptum.jesaya.my.id/create-a-simple-kubernetes-cluster-with-microk8s</link><guid isPermaLink="true">https://scriptum.jesaya.my.id/create-a-simple-kubernetes-cluster-with-microk8s</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[microk8s]]></category><category><![CDATA[containers]]></category><category><![CDATA[Devops]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Jesaya Fernando Napitupulu]]></dc:creator><pubDate>Sat, 24 Jun 2023 13:06:14 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-overview">Overview</h1>
<p>Kubernetes is a container orchestration tool for managing containerized workloads and services. For creating a Kubernetes cluster, you should set up a container runtime and other configurations to initialize it. With MicroK8s, you can initialize a Kubernetes cluster in a simple way for learning Kubernetes.</p>
<h1 id="heading-prerequisites">Prerequisites</h1>
<p>Two or more virtual machines for 1 master node and 1 or more worker node(s) with:</p>
<ul>
<li><p>Ubuntu 20.04 or newer</p>
</li>
<li><p>2 GB memory or more</p>
</li>
<li><p>20GB storage or more</p>
</li>
<li><p>Internet access</p>
</li>
</ul>
<h1 id="heading-steps">Steps</h1>
<ol>
<li><p><strong>Installing MicroK8s on the master node and worker node(s)</strong></p>
<p> On the master node and worker node(s)</p>
<pre><code class="lang-bash"> sudo snap install microk8s --classic
 sudo usermod -aG microk8s <span class="hljs-variable">$USER</span>
 sudo chown -fR <span class="hljs-variable">$USER</span> ~/.kube
 su - <span class="hljs-variable">$USER</span>
</code></pre>
</li>
<li><p><strong>Joining worker node(s) to master node</strong></p>
<p> On master node</p>
<pre><code class="lang-bash"> microk8s add-node
 ---output omitted---
 Use the <span class="hljs-string">'--worker'</span> flag to join a node as a worker not running the control
 plane, eg: microk8s join [master-node-ip]:25000/[some_value]/[some_value]--worker
 ---output omitted-
</code></pre>
<p> On worker node(s)</p>
<pre><code class="lang-bash"> microk8s join [master-node-ip]:25000/[some_value]/[some_value] --worker
 ---output omitted---
 Currently, this worker node is configured with the following kubernetes API server endpoints:
 - [master-node-ip] and port 16443, this is the cluster node contacted during the join operation.
 ---output omitted---
</code></pre>
</li>
<li><p><strong>Enable add-on</strong></p>
<p> On master node</p>
<pre><code class="lang-bash"> microk8s.enable dns dashboard metrics-server rbac
</code></pre>
</li>
<li><p><strong>Setup kubectl</strong></p>
<p> On master node</p>
<pre><code class="lang-bash"> sudo apt install apt-transport-https --yes
 sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
 <span class="hljs-built_in">echo</span> <span class="hljs-string">"deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main"</span> | sudo tee /etc/apt/sources.list.d/kubernetes.list
 sudo apt update
 sudo apt install kubectl -y
 microk8s.config &gt; ~/.kube/config
 <span class="hljs-built_in">echo</span> <span class="hljs-string">'source &lt;(kubectl completion bash)'</span> &gt;&gt;~/.bashrc
</code></pre>
</li>
<li><p><strong>Labeling and tainting node(s)</strong></p>
<pre><code class="lang-bash"> kubectl label [master-node-hostname] node-role.kubernetes.io/master=<span class="hljs-string">""</span>
 kubectl label [worker-node-hostname1] node-role.kubernetes.io/worker=<span class="hljs-string">""</span>
 kubectl taint [master-node-hostname1] node-role.kubernetes.io/master:NoSchedule
 kubectl label [worker-node-hostname(n)] node-role.kubernetes.io/worker=<span class="hljs-string">""</span>
 kubectl taint [master-node-hostname(n)] node-role.kubernetes.io/master:NoSchedule
</code></pre>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Create Kubernetes Cluster with CRI-O on Rocky Linux 9.1]]></title><description><![CDATA[Overview
As a container orchestration, Kubernetes help anyone who needs to deploy a container service in a declarative way. Kubernetes will manage and maintain every resource to meet the state needed by the developer. Developer simply defined the des...]]></description><link>https://scriptum.jesaya.my.id/create-kubernetes-cluster-with-cri-o-on-rocky-linux-91</link><guid isPermaLink="true">https://scriptum.jesaya.my.id/create-kubernetes-cluster-with-cri-o-on-rocky-linux-91</guid><category><![CDATA[Devops]]></category><category><![CDATA[containers]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[Kubernetes]]></category><dc:creator><![CDATA[Jesaya Fernando Napitupulu]]></dc:creator><pubDate>Sat, 24 Jun 2023 11:36:13 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-overview">Overview</h1>
<p>As a container orchestration, Kubernetes help anyone who needs to deploy a container service in a declarative way. Kubernetes will manage and maintain every resource to meet the state needed by the developer. Developer simply defined the desired state by JSON or YAML file and sends it to Kubernetes API. In this article, I will guide you to deploy a Kubernetes cluster with CRI-O as container runtime on RHEL-based OS, Rocky Linux 9.1.</p>
<h1 id="heading-installation">Installation</h1>
<h2 id="heading-pre-requisites">Pre-requisites</h2>
<p>We need 1 node for the control-plane node and at least 1 node or more nodes for the worker node with the specifications:</p>
<ul>
<li><p>Control-plane node:</p>
<ul>
<li><p>2 core or more processor</p>
</li>
<li><p>2 GB or more memory</p>
</li>
<li><p>Rocky Linux 9</p>
</li>
</ul>
</li>
<li><p>Worker node:</p>
<ul>
<li><p>4 core or more processor</p>
</li>
<li><p>8 GB or more memory</p>
</li>
<li><p>Rocky Linux 9</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-steps">Steps</h2>
<h3 id="heading-master-node">Master Node</h3>
<ol>
<li><p>Configure firewall on every node</p>
<p> You need to set firewall rules on the node(s) to open several inbound ports or connections between the Kubernetes cluster node based on <a target="_blank" href="https://kubernetes.io/docs/reference/networking/ports-and-protocols/">Kubernetes Documentation</a>.</p>
<pre><code class="lang-bash"> firewall-cmd --permanent --new-zone=kubernetes-master
 firewall-cmd --permanent --zone=kubernetes-master --add-service=ssh
 firewall-cmd --permanent --zone=kubernetes-master --add-port={6443,2379,2380,10250,10259,10257}/tcp
 firewall-cmd --reload
 firewall-cmd --permanent --zone=kubernetes-master --change-interface=enp1s0
 firewall-cmd --set-default-zone=kubernetes-master
</code></pre>
</li>
<li><p>Setup CRI-O</p>
<p> CRI-O repository will be added to YUM depending Kubernetes version want to be installed by specifying the <code>VERSION</code> environment variable.</p>
<pre><code class="lang-bash"> <span class="hljs-built_in">export</span> VERSION=1.26
 <span class="hljs-built_in">export</span> OS=CentOS_8_Stream
 curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:<span class="hljs-variable">$VERSION</span>.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/<span class="hljs-variable">$VERSION</span>/<span class="hljs-variable">$OS</span>/devel:kubic:libcontainers:stable:cri-o:<span class="hljs-variable">$VERSION</span>.repo
 yum install cri-o -y
 systemctl <span class="hljs-built_in">enable</span> --now crio
</code></pre>
</li>
<li><p>Setup kubeadm, kubelet, and kubectl</p>
<p> Kubernetes’ repository will be added to YUM and install kubelet, kubectl and kubeadm following the version of Kubernetes want to installed. See <a target="_blank" href="https://kubernetes.io/releases/">Kubernetes Releases</a>.</p>
<pre><code class="lang-bash"> cat &lt;&lt;EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
 [kubernetes]
 name=Kubernetes
 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\<span class="hljs-variable">$basearch</span>
 enabled=1
 gpgcheck=1
 gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
 exclude=kubelet kubeadm kubectl
 EOF
 <span class="hljs-comment"># Set SELinux in permissive mode (effectively disabling it)</span>
 sudo setenforce 0
 sudo sed -i <span class="hljs-string">'s/^SELINUX=enforcing$/SELINUX=permissive/'</span> /etc/selinux/config
 yum install kubelet-1.26.5 kubectl-1.26.5 kubeadm-1.26.5 --disableexcludes=kubernetes
</code></pre>
</li>
<li><p>Configure prerequisites</p>
<pre><code class="lang-bash"> cat &lt;&lt;EOF | sudo tee /etc/modules-load.d/k8s.conf
 overlay
 br_netfilter
 EOF

 modprobe overlay
 modprobe br_netfilter

 <span class="hljs-comment"># sysctl params required by setup, params persist across reboots</span>
 cat &lt;&lt;EOF | sudo tee /etc/sysctl.d/k8s.conf
 net.bridge.bridge-nf-call-iptables  = 1
 net.bridge.bridge-nf-call-ip6tables = 1
 net.ipv4.ip_forward                 = 1
 EOF

 <span class="hljs-comment"># Apply sysctl params without reboot</span>
 sysctl --system
</code></pre>
</li>
<li><p>Create kubeadm’s and InitConfiguration and ClusterConfiguration file for master node</p>
<pre><code class="lang-bash"> vim kubeadm-worker-conf.yaml
</code></pre>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">kubeadm.k8s.io/v1beta3</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">InitConfiguration</span>
 <span class="hljs-attr">nodeRegistration:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">"master-node0"</span>
  <span class="hljs-attr">criSocket:</span> <span class="hljs-string">"/var/run/crio/crio.sock"</span>
 <span class="hljs-string">---</span>
 <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">kubeadm.k8s.io/v1beta3</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">ClusterConfiguration</span>
 <span class="hljs-attr">networking:</span>
  <span class="hljs-attr">serviceSubnet:</span> <span class="hljs-string">"10.10.0.0/16"</span>
  <span class="hljs-attr">podSubnet:</span> <span class="hljs-string">"10.10.10.0/24"</span>
  <span class="hljs-attr">dnsDomain:</span> <span class="hljs-string">"jesaya.lab"</span>
 <span class="hljs-attr">kubernetesVersion:</span> <span class="hljs-string">"v1.26.5"</span>
 <span class="hljs-attr">controlPlaneEndpoint:</span> <span class="hljs-string">"[control-plane-ip]:6443"</span>
 <span class="hljs-attr">clusterName:</span> <span class="hljs-string">"[cluster-name]"</span>
</code></pre>
</li>
<li><p>Initialize Kubeadm</p>
<pre><code class="lang-bash"> systemctl <span class="hljs-built_in">enable</span> kubelet.service
 kubeadm init --config kubeadm-cluster-conf.yaml
</code></pre>
</li>
<li><p>Check the Kubernetes has been initilized</p>
<pre><code class="lang-bash"> mkdir -p <span class="hljs-variable">$HOME</span>/.kube
 cp -i /etc/kubernetes/admin.conf <span class="hljs-variable">$HOME</span>/.kube/config
 chown $(id -u):$(id -g) <span class="hljs-variable">$HOME</span>/.kube/config
 kubectl get node
</code></pre>
</li>
</ol>
<h3 id="heading-worker-nodes">Worker node(s)</h3>
<ol>
<li><p>Configure firewall on every node</p>
<p> You need to set firewall rules on the node(s) to open several inbound ports or connections between the Kubernetes cluster node based on <a target="_blank" href="https://kubernetes.io/docs/reference/networking/ports-and-protocols/">Kubernetes Documentation</a>.</p>
<pre><code class="lang-bash"> firewall-cmd --permanent --new-zone=kubernetes-worker
 firewall-cmd --permanent --zone=kubernetes-worker --add-service=ssh 
 firewall-cmd --permanent --zone=kubernetes-worker --add-port={10250,30000-32767}/tcp
 firewall-cmd --reload
 firewall-cmd --permanent --zone=kubernetes-worker --change-interface=enp1s0
 firewall-cmd --set-default-zone=kubernetes-worker
</code></pre>
</li>
<li><p>Setup CRI-O</p>
<p> CRI-O repository will be added to YUM depending Kubernetes version want to be installed by specifying the <code>VERSION</code> environment variable.</p>
<pre><code class="lang-bash"> <span class="hljs-built_in">export</span> VERSION=1.26
 <span class="hljs-built_in">export</span> OS=CentOS_8_Stream
 curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:<span class="hljs-variable">$VERSION</span>.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/<span class="hljs-variable">$VERSION</span>/<span class="hljs-variable">$OS</span>/devel:kubic:libcontainers:stable:cri-o:<span class="hljs-variable">$VERSION</span>.repo
 yum install cri-o -y
 systemctl <span class="hljs-built_in">enable</span> --now crio
</code></pre>
</li>
<li><p>Setup kubeadm, kubelet, and kubectl</p>
<p> Kubernetes’ repository will be added to YUM and install kubelet, kubectl and kubeadm following the version of Kubernetes want to installed. See <a target="_blank" href="https://kubernetes.io/releases/">Kubernetes Releases</a>.</p>
<pre><code class="lang-bash"> cat &lt;&lt;EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
 [kubernetes]
 name=Kubernetes
 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\<span class="hljs-variable">$basearch</span>
 enabled=1
 gpgcheck=1
 gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
 exclude=kubelet kubeadm kubectl
 EOF
 <span class="hljs-comment"># Set SELinux in permissive mode (effectively disabling it)</span>
 sudo setenforce 0
 sudo sed -i <span class="hljs-string">'s/^SELINUX=enforcing$/SELINUX=permissive/'</span> /etc/selinux/config
 yum install kubelet-1.26.5 kubeadm-1.26.5 --disableexcludes=kubernetes
</code></pre>
</li>
<li><p>Configure prerequisites needed on node</p>
<pre><code class="lang-bash"> cat &lt;&lt;EOF | sudo tee /etc/modules-load.d/k8s.conf
 overlay
 br_netfilter
 EOF

 modprobe overlay
 modprobe br_netfilter

 <span class="hljs-comment"># sysctl params required by setup, params persist across reboots</span>
 cat &lt;&lt;EOF | sudo tee /etc/sysctl.d/k8s.conf
 net.bridge.bridge-nf-call-iptables  = 1
 net.bridge.bridge-nf-call-ip6tables = 1
 net.ipv4.ip_forward                 = 1
 EOF

 <span class="hljs-comment"># Apply sysctl params without reboot</span>
 sysctl --system
</code></pre>
</li>
<li><p>Create kubeadm’s JoinConfiguration file for worker node</p>
<pre><code class="lang-bash"> vim kubeadm-worker-conf.yaml
</code></pre>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">kubeadm.k8s.io/v1beta3</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">JoinConfiguration</span>
 <span class="hljs-attr">nodeRegistration:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">"worker-node0"</span>
  <span class="hljs-attr">criSocket:</span> <span class="hljs-string">"/var/run/crio/crio.sock"</span>
 <span class="hljs-attr">discovery:</span> 
   <span class="hljs-attr">bootstrapToken:</span> 
     <span class="hljs-attr">token:</span> <span class="hljs-string">"[bootstrap-token]"</span>
     <span class="hljs-attr">apiServerEndpoint:</span> <span class="hljs-string">"[control-plane-ip]:6443"</span>
     <span class="hljs-attr">caCertHashes:</span> 
     <span class="hljs-bullet">-</span> <span class="hljs-string">"[CA-cert-Hash]"</span>
</code></pre>
</li>
<li><p>Joining worker node</p>
<pre><code class="lang-bash"> systemctl <span class="hljs-built_in">enable</span> kubelet.service
 kubeadm join --config kubeadm-worker-conf.yaml
</code></pre>
</li>
</ol>
]]></content:encoded></item></channel></rss>