<?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 Gvsridhar on Medium]]></title>
        <description><![CDATA[Stories by Gvsridhar on Medium]]></description>
        <link>https://medium.com/@gvsridhar?source=rss-18094fd27d29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*c485eim_r-62JY1oAfYi4w.jpeg</url>
            <title>Stories by Gvsridhar on Medium</title>
            <link>https://medium.com/@gvsridhar?source=rss-18094fd27d29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 12:19:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gvsridhar/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[Kubernetes: Cluster setup on AWS using Kubeadm]]></title>
            <link>https://gvsridhar.medium.com/kubernetes-cluster-setup-on-aws-using-kubeadm-ed8a06b01d55?source=rss-18094fd27d29------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed8a06b01d55</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubeadm]]></category>
            <dc:creator><![CDATA[Gvsridhar]]></dc:creator>
            <pubDate>Thu, 24 Dec 2020 01:08:52 GMT</pubDate>
            <atom:updated>2020-12-24T01:08:52.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*9RQmqZKCKMewUMsAf12xwA.png" /></figure><p>Having own K8s cluster helped me practice more for CAKD exam preparation. This article helps to quickly setup multi node Kubernets cluster on AWS EC2 instances using Kubeadm. Creating Kubernetes cluster using kubeadm gives better insight on several low level components.</p><p>The steps described in this article can be used to spin K8s cluster on any Linux server/VMs as well.</p><h4><strong>AWS Infrastructure setup:</strong></h4><p>I am not covering EC2 instance setup in this article.</p><ol><li>3 AWS Amazon Linux2 EC2 instances</li><li>Allow all communication between EC2 instances</li><li>Passwordless SSH between EC2 instances</li></ol><p>Important: Do not change the hostnames set by AWS</p><h4><strong>Kubernetes cluster set up</strong></h4><p>WARNING: This setup is only for learning and cant be used for production workloads<br><strong>STEP1: Install Docker and Kubernets components<br></strong>Run following commands as root on all 3 EC2 instances:</p><pre>As root run the below commands</pre><pre>#Disable firewall<br>systemctl stop firewalld<br>systemctl disable firewalld</pre><pre>#Disable swap<br>swapoff -a</pre><pre>#Disable SELinux<br>sed -i ‘s/enforcing/disabled/g’ /etc/selinux/config</pre><pre>cat &lt;&lt;EOF &gt; /etc/sysctl.d/k8s.conf<br>net.bridge.bridge-nf-call-ip6tables = 1<br>net.bridge.bridge-nf-call-iptables = 1<br>net/bridge/bridge-nf-call-arptables = 1<br>EOF</pre><pre>sysctl net.bridge.bridge-nf-call-iptables=1<br>sysctl net.ipv4.ip_forward=1<br>sysctl --system</pre><pre>echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward</pre><pre>reboot</pre><pre>#Kubernetes repo</pre><pre>cat &lt;&lt;EOF &gt; /etc/yum.repos.d/kubernetes.repo<br>[kubernetes]<br>name=Kubernetes<br>baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64<br>enabled=1<br>gpgcheck=0<br>repo_gpgcheck=0<br>gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg <a href="https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg">https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg</a><br>exclude=kube*<br>EOF</pre><pre>yum update -y<br>yum install -y docker kubeadm kubectl kubelet --disableexcludes=kubernetes</pre><pre>#Start an enable docker and kubelet<br>systemctl enable docker &amp;&amp; systemctl start docker<br>systemctl enable kubelet &amp;&amp; systemctl start kubelet</pre><p>Note: The Kubelet that is deployed next to the Kubeadm package will crashloop until you start kubeadm init. Check the status of the Kubelet after kubeadm init finishes</p><p><strong>STEP 2: Initialize the cluster using below command on master node.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*paTypp00ciUfUaGO5nITCw.png" /></figure><p>Save the output somewhere as we need it to add worker nodes to the cluster.</p><p><strong>STEP 3: To start using your cluster, you need to run the following as a regular user:</strong></p><pre><strong>As ec2-user<br></strong>mkdir -p $HOME/.kube<br>sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br>sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre><pre>mkdir -p $HOME/.kube<br>sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br>sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre><p><strong>STEP 4: Install Pod network plugin</strong></p><p>We are using Calico for this set up.<br>kubectl apply -f <a href="https://docs.projectcalico.org/v3.11/manifests/calico.yaml">https://docs.projectcalico.org/v3.11/manifests/calico.yaml</a></p><p>At this point, the node status will change to Ready in the output of <br>kubectl get nodes</p><p><strong>STEP 5: Join nodes to cluster</strong></p><p>On worker nodes run the below command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*FO9CEzgqEhXlg_yQVxQKWw.png" /></figure><p>Note: The above command is the output of Step 2</p><p><strong>STEP 6: Check the node status</strong><br>Once worker nodes are added with master node check the node status on k8s master node.<br>kubectl get nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*0lvRhwUmLKOqGzb3G3pM6A.png" /></figure><p><strong>STEP 7: Setup Metrics server</strong></p><p>In order to check node and pod metrics like cpu and memory usage, we need metrics server which is not configured as part of above setup.</p><p>wget <a href="https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml">https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml</a></p><p>In components.yaml file, edit the metrics-server deployment section to disable certificate check (line in bold added to args)</p><pre>129     spec:<br>130       containers:<br>131       - args:<br>132         - --cert-dir=/tmp<br>133         - --secure-port=4443<br>134         - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname<br>135         - --kubelet-use-node-status-port<br>136         <strong>- --kubelet-insecure-tls</strong></pre><p>kubectl create -f components.yaml<br>Now, you can get node/pod metrics</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*1Rl9u6oACM0Ms_ad-cVfGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*XZ66LVCr76G_zLIMtyzxaQ.png" /></figure><p><strong>STEP 8: Check pod status</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnRoVSNAGrpgBCHFE2LfIg.png" /></figure><h4>Cluster cleanup</h4><p>Refer <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/</a></p><pre><strong>On Master node</strong><br>kubectl drain &lt;worker-node-hostname&gt; --delete-local-data --force --ignore-daemonsets<br>kubectl delete node &lt;node name&gt;</pre><pre><strong>On all nodes</strong><br>rm -rf /etc/cni/net.d<br>rm -rf /etc/cni /etc/kubernetes /var/lib/dockershim /var/lib/etcd /var/lib/kubelet /var/run/kubernetes ~/.kube/*<br>iptables -F &amp;&amp; iptables -t nat -F &amp;&amp; iptables -t mangle -F &amp;&amp; iptables -t raw -F &amp;&amp; iptables -X<br>systemctl restart docker</pre><pre><strong>Cleanup the controlplane<br></strong>kubeadm reset</pre><p>Give it a try and respond here if any issues. Happy to assist!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed8a06b01d55" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>