<?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 Karthi Keyan on Medium]]></title>
        <description><![CDATA[Stories by Karthi Keyan on Medium]]></description>
        <link>https://medium.com/@karthikeyan_krishnaswamy?source=rss-460f438d637d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*njsvvsI1jpUkrrvLzcrPzw.jpeg</url>
            <title>Stories by Karthi Keyan on Medium</title>
            <link>https://medium.com/@karthikeyan_krishnaswamy?source=rss-460f438d637d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:48:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karthikeyan_krishnaswamy/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[Why weekend work feels so tempting (and tricky)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@karthikeyan_krishnaswamy/why-weekend-work-feels-so-tempting-and-tricky-2a88196e5d51?source=rss-460f438d637d------2"><img src="https://cdn-images-1.medium.com/max/2102/1*PCPxBe8QW7dEBfDy-0-GNg.png" width="2102"></a></p><p class="medium-feed-snippet">Why weekend work feels so tempting (and tricky)</p><p class="medium-feed-link"><a href="https://medium.com/@karthikeyan_krishnaswamy/why-weekend-work-feels-so-tempting-and-tricky-2a88196e5d51?source=rss-460f438d637d------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@karthikeyan_krishnaswamy/why-weekend-work-feels-so-tempting-and-tricky-2a88196e5d51?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a88196e5d51</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[teamwork]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 02:25:10 GMT</pubDate>
            <atom:updated>2026-04-11T02:25:10.322Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The 2:17 AM Test: Authority vs Influence in Tech Leadership]]></title>
            <link>https://medium.com/@karthikeyan_krishnaswamy/the-2-17-am-test-authority-vs-influence-in-tech-leadership-ef666cd3fe16?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef666cd3fe16</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 05:43:07 GMT</pubDate>
            <atom:updated>2026-02-19T05:48:29.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsdc-CyeQlBh12qj6rcWMg.png" /></figure><p>2:17 AM.</p><p>PagerDuty goes off.</p><p>Production is down.<br>Checkout is failing.<br>Revenue impact is ticking.</p><p>The Slack channel lights up. The bridge call opens. Cameras off. Voices tense.</p><p>In these moments, leadership style becomes visible.</p><p>Not in theory.<br>Not in performance reviews.<br>But in real time.</p><p>I’ve seen two different managers handle almost identical incidents.</p><p>Neither was wrong. Neither had bad intentions.</p><p>But the long-term impact on their teams was very different.</p><h3>Night One: The Authority-Leaning Response</h3><p>The manager joins the bridge within minutes. Calm. Structured. Focused.</p><p>“Alright, let’s stay tight.<br>Restart the pods in cluster A.<br>Check DB connections.<br>Let’s avoid guessing, verify first.<br>Updates every five minutes.”</p><p>Clear structure. Clear assignments.</p><p>Nobody talks over each other. The call feels controlled.</p><p>Someone starts to suggest a theory about a recent config change.</p><p>The manager replies:</p><ul><li>“Good thought. Let’s stabilize first. We’ll deep dive after.”</li><li>Fair. Logical. Efficient.</li><li><strong>23 minutes</strong> later, production stabilizes.</li></ul><p>The manager closes:</p><ul><li>“Nice recovery. Let’s ensure monitoring catches this earlier next time.”</li><li>Call ends.</li><li>No drama. No raised voices. No humiliation.</li><li>The team respects this manager. In crisis, they feel protected.</li></ul><p>But over time, something subtle happens:</p><ul><li>Engineers hesitate before speaking unless they are certain.</li><li>Suggestions are mentally filtered.</li><li>People execute precisely but rarely expand beyond what’s asked.</li><li>The manager builds control.</li><li>And in high-severity moments, control works.</li></ul><p>But the team slowly internalizes a message:</p><blockquote>Stability comes from the manager’s direction.</blockquote><h3>Night Two: The Influence-Leaning Response</h3><p>A few weeks later, another outage. A different manager joins.</p><p>“Quick sync: what do we know so far?”</p><p>Assignments are still made.<br>Ownership is still clear.<br>Deadlines still exist.</p><p>But one line changes the tone:</p><ul><li>“If something feels off, say it out loud. Even if you’re not sure.”</li><li>10 minutes in, a junior engineer says:</li><li>“Memory was trending up yesterday. I didn’t escalate because autoscaling handled it.”</li></ul><p>The manager responds:</p><ul><li>“That’s helpful. Let’s stabilize first. Then we’ll review that signal.”</li><li><strong>26 minutes</strong> later, production is stable.</li></ul><p>Before ending the call:</p><ul><li>“What signal did we miss?”</li><li>The junior engineer speaks again, more confidently this time.</li></ul><p>Next sprint:</p><ul><li>Alert thresholds improve.</li><li>Escalation patterns change.</li><li>Weak signals surface earlier.</li></ul><p>This manager also had authority.</p><p>But used it to widen ownership, not just tighten control.</p><p>Over time, the team learns:</p><blockquote>Stability is everyone’s responsibility. This manager builds capacity.</blockquote><h3>Authority vs Influence</h3><p><strong>Authority says:</strong></p><p>“Move because I can require it.”</p><p><strong>Influence says:</strong></p><p>“Move because you feel responsible.”</p><ul><li>Both get results.</li><li>But they optimize for different outcomes.</li></ul><blockquote>Authority is fast.<br>Influence compounds.</blockquote><blockquote>Authority reduces chaos.<br>Influence reduces dependency.</blockquote><blockquote>Authority fixes production.<br>Influence improves production.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef666cd3fe16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leading Your Team Through Change (Without Burning Them Out)]]></title>
            <link>https://medium.com/@karthikeyan_krishnaswamy/leading-your-team-through-change-without-burning-them-out-fcdbd8d471ae?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcdbd8d471ae</guid>
            <category><![CDATA[engineering-mangement]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 04:05:02 GMT</pubDate>
            <atom:updated>2026-02-11T04:08:31.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAWXeYKOuq1F83ruzC_Kow.png" /></figure><p>Change is rarely the hard part.</p><p>What’s hard is realizing that while <em>you</em> may be ready for it,<br> your team might be tired, skeptical, or quietly disengaged.</p><p>Over time, I’ve learned that successful change leadership starts not with plans or metrics but with <strong>understanding how people actually feel</strong>.</p><h3>The Support Continuum: Read the Room Before You Lead</h3><p>One framework that helped me articulate this better is the <strong>Support Continuum</strong>. It describes how team members typically respond to change across five levels:</p><h3>1. Active Resistors</h3><ul><li>These are visible and vocal.</li><li>They challenge decisions repeatedly, focus on what’s broken, and can influence others negatively if left unaddressed. Ignoring them rarely works. Engaging them early sometimes does.</li></ul><h3>2. Passive Resistors</h3><p>Often misunderstood and far more common.</p><p>They appear compliant but resist through silence or inaction.<br> In many cases, this comes from:</p><ul><li>Change fatigue</li><li>Burnout</li><li>Low psychological safety</li><li>Feeling unheard or overlooked</li></ul><p>Treating passive resistance as “lack of motivation” is a leadership failure.</p><h3>3. Neutral</h3><ul><li>Undecided and observant.</li><li>This group is watching leadership behavior closely.</li><li>They’ll move in the direction your actions point more than your words.</li></ul><h3>4. Passive Supporters</h3><ul><li>They agree with the change but don’t actively push it forward.</li><li>With clarity, encouragement, and ownership, many of them become your strongest allies.</li></ul><h3>5. Vocal Supporters</h3><ul><li>These are your champions.</li><li>They model the behavior, influence peers, and help sustain momentum long after the announcement is over.</li></ul><p><strong>The mistake many leaders make:</strong><br> Assuming everyone is already a supporter and communicating accordingly.</p><h3>Pulse Checks: Small Signals, Big Clarity</h3><p>Once you understand where people might sit, you need a way to <strong>continuously listen</strong>.</p><p>That’s where pulse checks matter.</p><p>Pulse checks are short, frequent feedback loops (2–3 minutes) designed to:</p><ul><li>Detect burnout early</li><li>Surface trust or communication gaps</li><li>Understand workload and clarity</li><li>Build psychological safety over time</li></ul><p>Simple questions work best:</p><ul><li>How heavy does your workload feel today? (1–5)</li><li>Are priorities clear? (Yes/No)</li><li>What’s blocking you right now?</li><li>One thing we could improve?</li></ul><p>In SRE or engineering teams, this can be even more specific:</p><ul><li>How’s the on-call load?</li><li>Are incidents resolved as a team or in silos?</li><li>Is tooling helping — or slowing you down?</li></ul><p>Pulse checks don’t fix problems instantly.<br> They <strong>prevent surprises later</strong>.</p><h3>Reinforcing Change: Where Most Efforts Fail</h3><ul><li>Announcing change is easy.</li><li>Sustaining it is where leadership shows up.</li><li>A reinforcement framework that resonated with me has five simple steps:</li></ul><h3>1. Start With “Why”</h3><p>Explain why the change matters:</p><ul><li>To the individual</li><li>To the business</li><li>To the customer</li></ul><p>Then ask team members to explain it back in their own words.<br> If they can’t, alignment doesn’t exist yet.</p><h3>2. Lead Out in Front</h3><p>People copy what leaders do, not what they say.</p><p>Consistency matters:</p><ul><li>Regular meetings</li><li>Clear agendas</li><li>Predictable follow-through</li></ul><p>Credibility is built quietly, over time.</p><h3>3. Measure What Truly Matters</h3><ul><li>Avoid metric overload.</li></ul><p>Find <strong>one key indicator</strong> that reflects the behavior or outcome you want and reinforce that relentlessly.</p><h3>4. Find the “Moneyballers”</h3><p>Every team has people already doing the right thing.</p><ul><li>Spotlight them.</li><li>Give them space to share how they work.</li><li>Let peers learn from peers.</li></ul><p>This creates pull instead of push.</p><h3>5. Hold People Accountable</h3><p>Change without accountability is just a suggestion.</p><ul><li>Recognize and reward those who embrace it</li><li>Have honest conversations with those who resist it</li></ul><p>Accountability isn’t punishment it’s clarity.</p><h3>Final Thought</h3><p>Leading change isn’t about pushing harder or moving faster.</p><p>It’s about:</p><ul><li>Understanding emotional readiness</li><li>Listening continuously</li><li>Modeling first</li><li>Reinforcing consistently</li></ul><p>When leaders get this right, change stops feeling like disruption and starts feeling like progress.</p><blockquote><em>This article was inspired by the LinkedIn Learning course </em><strong><em>“Leading Your Team Through Change: A Proven Playbook for Leading Change”</em></strong><em>, combined with my own experience working with engineering and SRE teams.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcdbd8d471ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAID — Explained in 5 mins]]></title>
            <link>https://faun.pub/raid-explained-in-5-mins-389dc174a7b9?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/389dc174a7b9</guid>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 13:08:40 GMT</pubDate>
            <atom:updated>2026-03-17T12:23:36.619Z</atom:updated>
            <content:encoded><![CDATA[<h3>RAID — Explained in 5 mins</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QIQGmZrT-E_tVMBA2ImvA.png" /></figure><p><strong>What is RAID and its types ?</strong><br>RAID is used to store same data across multiple hard disks to avoid the data loss and also to improve performance.<br><br>Mostly commonly used types are,</p><ul><li>RAID 0</li><li>RAID 1</li><li>RAID 5</li><li>RAID 6</li><li>RAID 10</li></ul><h3>Things to remember:</h3><h4>RAID 0:</h4><ul><li>RAID 0 is ‘stripping’.</li><li>Minimum 2 disks.</li><li>There is no data redundancy.</li><li>If the data is not important than the speed then we can use ‘RAID 0’</li><li>Example: We can use RAID 0 for SWAP Partition.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*_emO0aa60_X4F9oikFxIKw.png" /></figure><h4>RAID 1:</h4><ul><li>RAID 1 is Mirroring.</li><li>Minimum 2 disks.</li><li>RAID 1 is exact copy of another disk.</li><li>It has data redundancy</li><li>But write speed is low when compared to ‘RAID 0’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*XSijfiaIDYW1twNcS9I32A.png" /></figure><h4>RAID 5:</h4><ul><li>RAID 5 is the combination of ‘Data Stripping’ and ‘Parity bit’</li><li>Minimum 3 disks.</li><li>It has data redundancy.</li><li>If 1 hard disk failed then we can recover the data by using parity bit, but if two hard disks fails we cannot recover the data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*677f4Mfqh3XBUvDT3aYX-g.png" /></figure><h4>RAID 6:</h4><ul><li>RAID 6 is ‘Double Distributed Parity Bit’</li><li>Minimum 4 disks.</li><li>It has data redundancy.</li><li>If 2 hard disks failed then we can recover the data by using parity bit, but in RAID 5 we cannot recover the data in this case.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*5xPv7MUbBvVmj_sE0o5Giw.png" /></figure><h4>RAID: 10</h4><ul><li>RAID 10 is the combination of ‘Stripping’ and ‘Mirroring’</li><li>Minimum 4 disks.</li><li>It has data redundancy.</li><li>We can recover the data even if two hard disks failed but its depends on where the disk is failing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*Ccgx6uRorF2hne5WNeet3A.png" /></figure><h3><strong>Commands to configure RAID:</strong></h3><p>1. For creating Raid</p><pre># mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1</pre><p>Here we created RAID 5.</p><p>2. To see the details of RAID array,</p><pre># mdadm - detail /dev/md0</pre><p>3. To stop the RAID,</p><pre># mdadm - stop /dev/md0</pre><p>4. To start the RAID,</p><pre># mdadm - start /dev/md0</pre><p>5. To create File system on Raid device,</p><pre># mkfs.ext4 /dev/md0</pre><p>This is same like creating file system for partitions.</p><p>6. To Remove the partitions from RAID,</p><pre># mdadm - manage /dev/md0 - fail /dev/sdb1<br># mdadm - manage /dev/md0 - remove /dev/sdb1</pre><p>Here we remove the partition ‘/dev/sdb1’ from the RAID.</p><p>We can also see the RAID status by using below file,</p><pre># cat /proc/mdstat</pre><p>7. To add the Partitions to RAID,</p><pre># mdadm - manage /dev/md0 - add /dev/sdb1</pre><p>Verify it using,</p><pre># cat /proc/mdstat</pre><h3>Recommend RAID types:</h3><p>Depends on the scenario, pick the type wisely,</p><p><strong>RAID 0</strong></p><blockquote>Will use RAID 0, when the data is not important and the speed. is required.</blockquote><p><strong>RAID 1</strong></p><blockquote>Will use RAID 1, when the data is important and speed is not required.</blockquote><p><strong>RAID 5</strong></p><blockquote>Will use when both Data and Speed is required, but not compared to RAID 1 speed.</blockquote><p><strong>RAID 10</strong></p><blockquote>Will use when both Data and Speed is required and cost is not an problem.</blockquote><h3>Conclusion — Take Away</h3><p>Depends on the RAID level selection the disk size will vary, please refer below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*pYkY9wuf7BXbsDQ5r_RqNg.png" /></figure><p>Thanks for reading, happy learning!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Df9TOr_zZ49oNiFG.png" /></figure><h4>👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇</h4><h4>🚀<a href="http://from.faun.to/r/8zxxd">Join FAUN.dev() &amp; get similar stories in your inbox each week for free!</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=389dc174a7b9" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/raid-explained-in-5-mins-389dc174a7b9">RAID — Explained in 5 mins</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GOLANG — Functions]]></title>
            <link>https://faun.pub/golang-functions-8ffd94f511ff?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ffd94f511ff</guid>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 10:03:57 GMT</pubDate>
            <atom:updated>2026-03-17T12:23:30.619Z</atom:updated>
            <content:encoded><![CDATA[<h3>GOLANG — Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mg-0CuiVxaJ1bYTegUMR3Q.png" /></figure><h3>What is a Function ?</h3><ul><li>A function is a block of code that is used to performs a specific task.</li><li>A function can take zero or more arguments.</li><li>Suppose, you need to create a program to create a circle and color it. You can create two functions to solve this problem:</li></ul><ol><li>create a circle function</li><li>create a color function</li></ol><p><strong>Advantages of using Functions</strong></p><ul><li>Dividing a complex problem into smaller chunks makes our program easy to understand and reuse.</li><li>They provide better modularity for your application and reuse-ability. Some classic example of functions are <strong>Println()</strong> and <strong>main()</strong></li></ul><p><strong>A Sample Function</strong></p><pre>package main<br><br>import &quot;fmt&quot;<br><br>func add(x int, y int) int {<br> return x + y<br>}<br><br>func main() {<br> fmt.Println(add(42, 13))<br>}</pre><h3>Function Declaration in Golang</h3><p>Function declaration means a way to construct a function.<br><strong>Syntax:</strong></p><pre>func function_name(Parameter-list)(Return_type){<br>    // function body.....<br>}</pre><p>The declaration of the function contains:</p><ul><li><strong>func: </strong>It is a keyword in Go language, which is used to create a function.</li><li><strong>function_name: </strong>It is the name of the function.</li><li><strong>Parameter-list: </strong>It contains the name and the type of the function parameters.</li><li><strong>Return_type: </strong>It is optional and it contain the types of the values that function returns. If you are using return_type in your function, then it is necessary to use a return statement in your function.</li></ul><h3>Syntax</h3><blockquote><strong>func (receiver) identifier(parameters) (returns) { code }</strong></blockquote><p>know the difference between parameters and arguments</p><ul><li>we define our func with <strong>parameters</strong> (if any)</li><li>we call our func and pass in <strong>arguments</strong> (in any)</li></ul><p>Let’s explore more example of functions.</p><h4>Example 1: Basic Function</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo()<br>}<br>// func (r receiver) identifier(parameters) (return(s)) { ... }<br>func foo() {<br> fmt.Println(&quot;hello from foo&quot;)<br>}</pre><p>Everything in Go is PASS BY VALUE</p><h4>Example 2: Takes an argument</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo()<br> bar(&quot;James&quot;)<br>}<br>func foo() {<br> fmt.Println(&quot;hello from foo&quot;)<br>}<br>// everything in Go is PASS BY VALUE<br>func bar(s string) {<br> fmt.Println(&quot;Hello,&quot;, s)<br>}</pre><p>Purpose of functions</p><ul><li>abstract code</li><li>code reusability</li></ul><h4>Example 3: Return</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo()<br> bar(&quot;James&quot;)<br> s1 := woo(&quot;Moneypenny&quot;)<br> fmt.Println(s1)<br>}<br>func foo() {<br> fmt.Println(&quot;hello from foo&quot;)<br>}<br>func bar(s string) {<br> fmt.Println(&quot;Hello,&quot;, s)<br>}<br>func woo(st string) string {                // this means, it will return a string<br> return fmt.Sprint(&quot;Hello from woo, &quot;, st)<br>}</pre><h4>Example 4: Return</h4><pre>package main<br>import &quot;fmt&quot;<br>func plus(a int, b int) int {         // This is how we should call this function from main<br>    return a + b<br>}<br>func plusPlus(a, b, c int) int {      // here a,b,c are called parameters<br>    return a + b + c<br>}<br>func main() {<br>    res := plus(1, 2)                 // Calling the function by passing the arguments<br>    fmt.Println(&quot;1+2 =&quot;, res)<br>    res = plusPlus(1, 2, 3)<br>    fmt.Println(&quot;1+2+3 =&quot;, res)<br>}</pre><h4>Example 5: Multiple Returns</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo()<br> bar(&quot;James&quot;)<br> s1 := woo(&quot;Moneypenny&quot;)<br> fmt.Println(s1)<br> x, y := mouse(&quot;Ian&quot;, &quot;Fleming&quot;)<br> fmt.Println(x)<br> fmt.Println(y)<br>}<br>func foo() {<br> fmt.Println(&quot;hello from foo&quot;)<br>}<br>func bar(s string) {<br> fmt.Println(&quot;Hello,&quot;, s)<br>}<br>func woo(st string) string {<br> return fmt.Sprint(&quot;Hello from woo, &quot;, st)<br>}<br>func mouse(fn string, ln string) (string, bool) {<br> a := fmt.Sprint(fn, &quot; &quot;, ln, `, says &quot;Hello&quot;`)<br> b := true<br> return a, b<br>}</pre><h4>Example 6: Multiple Returns</h4><pre>package main<br>import &quot;fmt&quot;<br>func vals() (int, int) {<br>    return 3, 7<br>}<br>func main() {<br>    a, b := vals()<br>    fmt.Println(a)<br>    fmt.Println(b)<br>    _, c := vals()<br>    fmt.Println(c)<br>}</pre><h3>Variadic Parameter</h3><p><a href="http://en.wikipedia.org/wiki/Variadic_function"><em>Variadic functions</em></a> can be called with any number of trailing arguments. For example, fmt.Println is a common variadic function.</p><p>You can create <strong>a func which takes an unlimited number of arguments. </strong>When you do this, this is known as a “variadic parameter.” When use the lexical element operator “…T” to signify a variadic parameter (there “T” represents some type).</p><h4>Example 1:</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo(2, 3, 4, 5, 6, 7, 8, 9)<br>}<br>func foo(x ...int) {<br>    fmt.Println(x)<br>    fmt.Println(&quot;%T\n&quot;, x)<br>}<br>/// func (r receiver) identifier(parameter(s)) (return(s)) { code}</pre><h4>Example 2:</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> x := sum(2, 3, 4, 5, 6, 7, 8, 9)<br> fmt.Println(&quot;The total is&quot;, x)<br>}<br>func sum(x ...int) int {<br> fmt.Println(x)<br> fmt.Printf(&quot;%T\n&quot;, x)<br> sum := 0<br> for i, v := range x {<br>  sum += v<br>  fmt.Println(&quot;for item in index position&quot;, i, &quot;we are now adding&quot;, v, &quot;to the total which is now&quot;, sum)<br> }<br> fmt.Println(&quot;The total is&quot;, sum)<br> return sum<br>}<br>/// func (r receiver) identifier(parameter(s)) (return(s)) { code}</pre><h4>Example 3:</h4><pre>package main<br>import &quot;fmt&quot;<br>func sum(nums ...int) {<br>    fmt.Print(nums, &quot; &quot;)<br>    total := 0<br>    for _, num := range nums {<br>        total += num<br>    }<br>    fmt.Println(total)<br>}<br>func main() {<br>    sum(1, 2)<br>    sum(1, 2, 3)<br>    nums := []int{1, 2, 3, 4}<br>    sum(nums...)<br>}</pre><h3>Unfurling a slice</h3><p>When you have a slice of some type, you can <strong>pass in the individual values in a slice by using the “…” operator.</strong></p><p><strong>Example 1: unfurling a slice of int</strong></p><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> xi := []int{2, 3, 4, 5, 6, 7, 8, 9}<br> x := sum(xi...)<br> fmt.Println(&quot;The total is&quot;, x)<br>}<br>func sum(x ...int) int {<br> fmt.Println(x)<br> fmt.Printf(&quot;%T\n&quot;, x)<br> sum := 0<br> for i, v := range x {<br>  sum += v<br>  fmt.Println(&quot;for item in index position&quot;, i, &quot;we are now adding&quot;, v, &quot;to the total which is now&quot;, sum)<br> }<br> fmt.Println(&quot;The total is&quot;, sum)<br> return sum<br>}<br>/// func (r receiver) identifier(parameter(s)) (return(s)) { code}</pre><h4>Example 2: passing in zero or more values</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> x := sum()<br> fmt.Println(&quot;The total is&quot;, x)<br>}<br>func sum(x ...int) int {<br> fmt.Println(x)<br> fmt.Printf(&quot;%T\n&quot;, x)<br> sum := 0<br> for i, v := range x {<br>  sum += v<br>  fmt.Println(&quot;for item in index position&quot;, i, &quot;we are now adding&quot;, v, &quot;to the total which is now&quot;, sum)<br> }<br> fmt.Println(&quot;The total is&quot;, sum)<br> return sum<br>}<br>/// func (r receiver) identifier(parameter(s)) (return(s)) { code}</pre><h4>Example 3: variadic parameter has to be the final parameter</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> x := sum(&quot;james&quot;)<br> fmt.Println(&quot;The total is&quot;, x)<br>}<br>func sum(s string, x ...int) int {<br> fmt.Println(x)<br> fmt.Printf(&quot;%T\n&quot;, x)<br> fmt.Println(len(x))<br> fmt.Println(cap(x))<br> sum := 0<br> for i, v := range x {<br>  sum += v<br>  fmt.Println(&quot;for item in index position&quot;, i, &quot;we are now adding&quot;, v, &quot;to the total which is now&quot;, sum)<br> }<br> fmt.Println(&quot;The total is&quot;, sum)<br> return sum<br>}<br>/// func (r receiver) identifier(parameter(s)) (return(s)) { code}</pre><h3>Defer</h3><p>A defer statement defers the execution of a function until the surrounding function returns.</p><p>The deferred call’s arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.</p><ul><li>A “defer” statement invokes a function whose <strong>execution is deferred to the moment the surrounding function returns</strong>, either because the surrounding function executed a return statement, reached the end of its function body, or because the corresponding goroutine is panicking.</li><li>personal anecdote: head down, ox plowing field; doing the work</li></ul><h4>Example 1:</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> foo()<br> bar()<br>}<br>func foo() {<br> fmt.Println(&quot;foo&quot;)<br>}<br>func bar() {<br> fmt.Println(&quot;bar&quot;)<br>}<br>foo<br>bar</pre><h4>Example 2:</h4><pre>package main<br>import (<br> &quot;fmt&quot;<br>)<br>func main() {<br> defer foo()<br> bar()<br>}<br>func foo() {<br> fmt.Println(&quot;foo&quot;)<br>}<br>func bar() {<br> fmt.Println(&quot;bar&quot;)<br>}<br>bar<br>foo</pre><p>Refer — <a href="https://blog.golang.org/defer-panic-and-recover">https://blog.golang.org/defer-panic-and-recover</a></p><p>That’s all folks. I just want to share some sample functions which helps anyone to copy/paste and make use of them for their needs.</p><p>Thanks for reading till here :-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Df9TOr_zZ49oNiFG.png" /></figure><h4>👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇</h4><h4>🚀<a href="http://from.faun.to/r/8zxxd">Join FAUN.dev() &amp; get similar stories in your inbox each week for free!</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ffd94f511ff" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/golang-functions-8ffd94f511ff">GOLANG — Functions</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install homebrew/telnet on m1 macOS]]></title>
            <link>https://faun.pub/install-brew-telnet-on-macos-5f76c0483c8?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f76c0483c8</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[telnet]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 18:50:37 GMT</pubDate>
            <atom:updated>2026-03-17T12:23:24.278Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*vrPQoc2QE-3BMhf-v8sbxg.png" /></figure><p>By default, the Telnet client is not installed on macOS. This article outlines the general steps to install telnet commands on your Mac.</p><p>Open Terminal and start to install Homebrew on macOS.</p><pre># /bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre><p>Input your administrator password and authorize the installation.</p><pre># /bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;<br>==&gt; Checking for `sudo` access (which may request your password)...<br>Password:<br>==&gt; This script will install:<br>/opt/homebrew/bin/brew<br>/opt/homebrew/share/doc/homebrew<br>/opt/homebrew/share/man/man1/brew.1<br>/opt/homebrew/share/zsh/site-functions/_brew<br>/opt/homebrew/etc/bash_completion.d/brew<br>/opt/homebrew<br>==&gt; The following new directories will be created:<br>/opt/homebrew/bin<br>/opt/homebrew/etc<br>/opt/homebrew/include<br>/opt/homebrew/lib<br>/opt/homebrew/sbin<br>/opt/homebrew/share<br>/opt/homebrew/var<br>/opt/homebrew/opt<br>/opt/homebrew/share/zsh<br>/opt/homebrew/share/zsh/site-functions<br>/opt/homebrew/var/homebrew<br>/opt/homebrew/var/homebrew/linked<br>/opt/homebrew/Cellar<br>/opt/homebrew/Caskroom<br>/opt/homebrew/Frameworks<br><br>Press RETURN/ENTER to continue or any other key to abort:<br>==&gt; /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew<br>==&gt; /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks<br>==&gt; /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks<br>==&gt; /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions<br>==&gt; /usr/bin/sudo /usr/sbin/chown karthikeyan /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks<br>==&gt; /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks<br>==&gt; /usr/bin/sudo /usr/sbin/chown -R karthikeyan:admin /opt/homebrew<br>==&gt; /usr/bin/sudo /bin/mkdir -p /Users/karthikeyan/Library/Caches/Homebrew<br>==&gt; /usr/bin/sudo /bin/chmod g+rwx /Users/karthikeyan/Library/Caches/Homebrew<br>==&gt; /usr/bin/sudo /usr/sbin/chown -R karthikeyan /Users/karthikeyan/Library/Caches/Homebrew<br>==&gt; Downloading and installing Homebrew...<br>remote: Enumerating objects: 224627, done.<br>remote: Counting objects: 100% (120/120), done.<br>remote: Compressing objects: 100% (101/101), done.<br>Receiving objects: 100% (224627/224627), 63.90 MiB | 5.75 MiB/s, done.<br>remote: Total 224627 (delta 27), reused 73 (delta 19), pack-reused 224507<br>Resolving deltas: 100% (165292/165292), done.<br>From https://github.com/Homebrew/brew<br> * [new branch]          dependabot/bundler/Library/Homebrew/bootsnap-1.16.0 -&gt; origin/dependabot/bundler/Library/Homebrew/bootsnap-1.16.0<br> * [new branch]          less-agressive-core-tap                             -&gt; origin/less-agressive-core-tap<br> * [new branch]          master                                              -&gt; origin/master<br> * [new branch]          setup-homebrew-test                                 -&gt; origin/setup-homebrew-test<br> * [new tag]             0.1                                                 -&gt; 0.1<br> * [new tag]             0.2                                                 -&gt; 0.2<br> * [new tag]             0.3                                                 -&gt; 0.3<br> * [new tag]             0.4                                                 -&gt; 0.4<br> * [new tag]             0.5                                                 -&gt; 0.5<br> * [new tag]             0.6                                                 -&gt; 0.6<br> * [new tag]             0.7                                                 -&gt; 0.7<br> * [new tag]             0.7.1                                               -&gt; 0.7.1<br> * [new tag]             0.8                                                 -&gt; 0.8<br> * [new tag]             0.8.1                                               -&gt; 0.8.1<br> * [new tag]             0.9                                                 -&gt; 0.9<br> * [new tag]             0.9.1                                               -&gt; 0.9.1<br> * [new tag]             0.9.2                                               -&gt; 0.9.2<br> * [new tag]             0.9.3                                               -&gt; 0.9.3<br> * [new tag]             0.9.4                                               -&gt; 0.9.4<br> * [new tag]             0.9.5                                               -&gt; 0.9.5<br> * [new tag]             0.9.8                                               -&gt; 0.9.8<br> * [new tag]             0.9.9                                               -&gt; 0.9.9<br> * [new tag]             1.0.0                                               -&gt; 1.0.0<br> * [new tag]             1.0.1                                               -&gt; 1.0.1<br> * [new tag]             1.0.2                                               -&gt; 1.0.2<br> * [new tag]             1.0.3                                               -&gt; 1.0.3<br> * [new tag]             1.0.4                                               -&gt; 1.0.4<br> * [new tag]             1.0.5                                               -&gt; 1.0.5<br> * [new tag]             1.0.6                                               -&gt; 1.0.6<br> * [new tag]             1.0.7                                               -&gt; 1.0.7<br> * [new tag]             1.0.8                                               -&gt; 1.0.8<br> * [new tag]             1.0.9                                               -&gt; 1.0.9<br> * [new tag]             1.1.0                                               -&gt; 1.1.0<br> * [new tag]             1.1.1                                               -&gt; 1.1.1<br> * [new tag]             1.1.10                                              -&gt; 1.1.10<br> * [new tag]             1.1.11                                              -&gt; 1.1.11<br> * [new tag]             1.1.12                                              -&gt; 1.1.12<br> * [new tag]             1.1.13                                              -&gt; 1.1.13<br> * [new tag]             1.1.2                                               -&gt; 1.1.2<br> * [new tag]             1.1.3                                               -&gt; 1.1.3<br> * [new tag]             1.1.4                                               -&gt; 1.1.4<br> * [new tag]             1.1.5                                               -&gt; 1.1.5<br> * [new tag]             1.1.6                                               -&gt; 1.1.6<br> * [new tag]             1.1.7                                               -&gt; 1.1.7<br> * [new tag]             1.1.8                                               -&gt; 1.1.8<br> * [new tag]             1.1.9                                               -&gt; 1.1.9<br> * [new tag]             1.2.0                                               -&gt; 1.2.0<br> * [new tag]             1.2.1                                               -&gt; 1.2.1<br> * [new tag]             1.2.2                                               -&gt; 1.2.2<br> * [new tag]             1.2.3                                               -&gt; 1.2.3<br> * [new tag]             1.2.4                                               -&gt; 1.2.4<br> * [new tag]             1.2.5                                               -&gt; 1.2.5<br> * [new tag]             1.2.6                                               -&gt; 1.2.6<br> * [new tag]             1.3.0                                               -&gt; 1.3.0<br> * [new tag]             1.3.1                                               -&gt; 1.3.1<br> * [new tag]             1.3.2                                               -&gt; 1.3.2<br> * [new tag]             1.3.3                                               -&gt; 1.3.3<br> * [new tag]             1.3.4                                               -&gt; 1.3.4<br> * [new tag]             1.3.5                                               -&gt; 1.3.5<br> * [new tag]             1.3.6                                               -&gt; 1.3.6<br> * [new tag]             1.3.7                                               -&gt; 1.3.7<br> * [new tag]             1.3.8                                               -&gt; 1.3.8<br> * [new tag]             1.3.9                                               -&gt; 1.3.9<br> * [new tag]             1.4.0                                               -&gt; 1.4.0<br> * [new tag]             1.4.1                                               -&gt; 1.4.1<br> * [new tag]             1.4.2                                               -&gt; 1.4.2<br> * [new tag]             1.4.3                                               -&gt; 1.4.3<br> * [new tag]             1.5.0                                               -&gt; 1.5.0<br> * [new tag]             1.5.1                                               -&gt; 1.5.1<br> * [new tag]             1.5.10                                              -&gt; 1.5.10<br> * [new tag]             1.5.11                                              -&gt; 1.5.11<br> * [new tag]             1.5.12                                              -&gt; 1.5.12<br> * [new tag]             1.5.13                                              -&gt; 1.5.13<br> * [new tag]             1.5.14                                              -&gt; 1.5.14<br> * [new tag]             1.5.2                                               -&gt; 1.5.2<br> * [new tag]             1.5.3                                               -&gt; 1.5.3<br> * [new tag]             1.5.4                                               -&gt; 1.5.4<br> * [new tag]             1.5.5                                               -&gt; 1.5.5<br> * [new tag]             1.5.6                                               -&gt; 1.5.6<br> * [new tag]             1.5.7                                               -&gt; 1.5.7<br> * [new tag]             1.5.8                                               -&gt; 1.5.8<br> * [new tag]             1.5.9                                               -&gt; 1.5.9<br> * [new tag]             1.6.0                                               -&gt; 1.6.0<br> * [new tag]             1.6.1                                               -&gt; 1.6.1<br> * [new tag]             1.6.10                                              -&gt; 1.6.10<br> * [new tag]             1.6.11                                              -&gt; 1.6.11<br> * [new tag]             1.6.12                                              -&gt; 1.6.12<br> * [new tag]             1.6.13                                              -&gt; 1.6.13<br> * [new tag]             1.6.14                                              -&gt; 1.6.14<br> * [new tag]             1.6.15                                              -&gt; 1.6.15<br> * [new tag]             1.6.16                                              -&gt; 1.6.16<br> * [new tag]             1.6.17                                              -&gt; 1.6.17<br> * [new tag]             1.6.2                                               -&gt; 1.6.2<br> * [new tag]             1.6.3                                               -&gt; 1.6.3<br> * [new tag]             1.6.4                                               -&gt; 1.6.4<br> * [new tag]             1.6.5                                               -&gt; 1.6.5<br> * [new tag]             1.6.6                                               -&gt; 1.6.6<br> * [new tag]             1.6.7                                               -&gt; 1.6.7<br> * [new tag]             1.6.8                                               -&gt; 1.6.8<br> * [new tag]             1.6.9                                               -&gt; 1.6.9<br> * [new tag]             1.7.0                                               -&gt; 1.7.0<br> * [new tag]             1.7.1                                               -&gt; 1.7.1<br> * [new tag]             1.7.2                                               -&gt; 1.7.2<br> * [new tag]             1.7.3                                               -&gt; 1.7.3<br> * [new tag]             1.7.4                                               -&gt; 1.7.4<br> * [new tag]             1.7.5                                               -&gt; 1.7.5<br> * [new tag]             1.7.6                                               -&gt; 1.7.6<br> * [new tag]             1.7.7                                               -&gt; 1.7.7<br> * [new tag]             1.8.0                                               -&gt; 1.8.0<br> * [new tag]             1.8.1                                               -&gt; 1.8.1<br> * [new tag]             1.8.2                                               -&gt; 1.8.2<br> * [new tag]             1.8.3                                               -&gt; 1.8.3<br> * [new tag]             1.8.4                                               -&gt; 1.8.4<br> * [new tag]             1.8.5                                               -&gt; 1.8.5<br> * [new tag]             1.8.6                                               -&gt; 1.8.6<br> * [new tag]             1.9.0                                               -&gt; 1.9.0<br> * [new tag]             1.9.1                                               -&gt; 1.9.1<br> * [new tag]             1.9.2                                               -&gt; 1.9.2<br> * [new tag]             1.9.3                                               -&gt; 1.9.3<br> * [new tag]             2.0.0                                               -&gt; 2.0.0<br> * [new tag]             2.0.1                                               -&gt; 2.0.1<br> * [new tag]             2.0.2                                               -&gt; 2.0.2<br> * [new tag]             2.0.3                                               -&gt; 2.0.3<br> * [new tag]             2.0.4                                               -&gt; 2.0.4<br> * [new tag]             2.0.5                                               -&gt; 2.0.5<br> * [new tag]             2.0.6                                               -&gt; 2.0.6<br> * [new tag]             2.1.0                                               -&gt; 2.1.0<br> * [new tag]             2.1.1                                               -&gt; 2.1.1<br> * [new tag]             2.1.10                                              -&gt; 2.1.10<br> * [new tag]             2.1.11                                              -&gt; 2.1.11<br> * [new tag]             2.1.12                                              -&gt; 2.1.12<br> * [new tag]             2.1.13                                              -&gt; 2.1.13<br> * [new tag]             2.1.14                                              -&gt; 2.1.14<br> * [new tag]             2.1.15                                              -&gt; 2.1.15<br> * [new tag]             2.1.16                                              -&gt; 2.1.16<br> * [new tag]             2.1.2                                               -&gt; 2.1.2<br> * [new tag]             2.1.3                                               -&gt; 2.1.3<br> * [new tag]             2.1.4                                               -&gt; 2.1.4<br> * [new tag]             2.1.5                                               -&gt; 2.1.5<br> * [new tag]             2.1.6                                               -&gt; 2.1.6<br> * [new tag]             2.1.7                                               -&gt; 2.1.7<br> * [new tag]             2.1.8                                               -&gt; 2.1.8<br> * [new tag]             2.1.9                                               -&gt; 2.1.9<br> * [new tag]             2.2.0                                               -&gt; 2.2.0<br> * [new tag]             2.2.1                                               -&gt; 2.2.1<br> * [new tag]             2.2.10                                              -&gt; 2.2.10<br> * [new tag]             2.2.11                                              -&gt; 2.2.11<br> * [new tag]             2.2.12                                              -&gt; 2.2.12<br> * [new tag]             2.2.13                                              -&gt; 2.2.13<br> * [new tag]             2.2.14                                              -&gt; 2.2.14<br> * [new tag]             2.2.15                                              -&gt; 2.2.15<br> * [new tag]             2.2.16                                              -&gt; 2.2.16<br> * [new tag]             2.2.17                                              -&gt; 2.2.17<br> * [new tag]             2.2.2                                               -&gt; 2.2.2<br> * [new tag]             2.2.3                                               -&gt; 2.2.3<br> * [new tag]             2.2.4                                               -&gt; 2.2.4<br> * [new tag]             2.2.5                                               -&gt; 2.2.5<br> * [new tag]             2.2.6                                               -&gt; 2.2.6<br> * [new tag]             2.2.7                                               -&gt; 2.2.7<br> * [new tag]             2.2.8                                               -&gt; 2.2.8<br> * [new tag]             2.2.9                                               -&gt; 2.2.9<br> * [new tag]             2.3.0                                               -&gt; 2.3.0<br> * [new tag]             2.4.0                                               -&gt; 2.4.0<br> * [new tag]             2.4.1                                               -&gt; 2.4.1<br> * [new tag]             2.4.10                                              -&gt; 2.4.10<br> * [new tag]             2.4.11                                              -&gt; 2.4.11<br> * [new tag]             2.4.12                                              -&gt; 2.4.12<br> * [new tag]             2.4.13                                              -&gt; 2.4.13<br> * [new tag]             2.4.14                                              -&gt; 2.4.14<br> * [new tag]             2.4.15                                              -&gt; 2.4.15<br> * [new tag]             2.4.16                                              -&gt; 2.4.16<br> * [new tag]             2.4.2                                               -&gt; 2.4.2<br> * [new tag]             2.4.3                                               -&gt; 2.4.3<br> * [new tag]             2.4.4                                               -&gt; 2.4.4<br> * [new tag]             2.4.5                                               -&gt; 2.4.5<br> * [new tag]             2.4.6                                               -&gt; 2.4.6<br> * [new tag]             2.4.7                                               -&gt; 2.4.7<br> * [new tag]             2.4.8                                               -&gt; 2.4.8<br> * [new tag]             2.4.9                                               -&gt; 2.4.9<br> * [new tag]             2.5.0                                               -&gt; 2.5.0<br> * [new tag]             2.5.1                                               -&gt; 2.5.1<br> * [new tag]             2.5.10                                              -&gt; 2.5.10<br> * [new tag]             2.5.11                                              -&gt; 2.5.11<br> * [new tag]             2.5.12                                              -&gt; 2.5.12<br> * [new tag]             2.5.2                                               -&gt; 2.5.2<br> * [new tag]             2.5.3                                               -&gt; 2.5.3<br> * [new tag]             2.5.4                                               -&gt; 2.5.4<br> * [new tag]             2.5.5                                               -&gt; 2.5.5<br> * [new tag]             2.5.6                                               -&gt; 2.5.6<br> * [new tag]             2.5.7                                               -&gt; 2.5.7<br> * [new tag]             2.5.8                                               -&gt; 2.5.8<br> * [new tag]             2.5.9                                               -&gt; 2.5.9<br> * [new tag]             2.6.0                                               -&gt; 2.6.0<br> * [new tag]             2.6.1                                               -&gt; 2.6.1<br> * [new tag]             2.6.2                                               -&gt; 2.6.2<br> * [new tag]             2.7.0                                               -&gt; 2.7.0<br> * [new tag]             2.7.1                                               -&gt; 2.7.1<br> * [new tag]             2.7.2                                               -&gt; 2.7.2<br> * [new tag]             2.7.3                                               -&gt; 2.7.3<br> * [new tag]             2.7.4                                               -&gt; 2.7.4<br> * [new tag]             2.7.5                                               -&gt; 2.7.5<br> * [new tag]             2.7.6                                               -&gt; 2.7.6<br> * [new tag]             2.7.7                                               -&gt; 2.7.7<br> * [new tag]             3.0.0                                               -&gt; 3.0.0<br> * [new tag]             3.0.1                                               -&gt; 3.0.1<br> * [new tag]             3.0.10                                              -&gt; 3.0.10<br> * [new tag]             3.0.11                                              -&gt; 3.0.11<br> * [new tag]             3.0.2                                               -&gt; 3.0.2<br> * [new tag]             3.0.3                                               -&gt; 3.0.3<br> * [new tag]             3.0.4                                               -&gt; 3.0.4<br> * [new tag]             3.0.5                                               -&gt; 3.0.5<br> * [new tag]             3.0.6                                               -&gt; 3.0.6<br> * [new tag]             3.0.7                                               -&gt; 3.0.7<br> * [new tag]             3.0.8                                               -&gt; 3.0.8<br> * [new tag]             3.0.9                                               -&gt; 3.0.9<br> * [new tag]             3.1.0                                               -&gt; 3.1.0<br> * [new tag]             3.1.1                                               -&gt; 3.1.1<br> * [new tag]             3.1.10                                              -&gt; 3.1.10<br> * [new tag]             3.1.11                                              -&gt; 3.1.11<br> * [new tag]             3.1.12                                              -&gt; 3.1.12<br> * [new tag]             3.1.2                                               -&gt; 3.1.2<br> * [new tag]             3.1.3                                               -&gt; 3.1.3<br> * [new tag]             3.1.4                                               -&gt; 3.1.4<br> * [new tag]             3.1.5                                               -&gt; 3.1.5<br> * [new tag]             3.1.6                                               -&gt; 3.1.6<br> * [new tag]             3.1.7                                               -&gt; 3.1.7<br> * [new tag]             3.1.8                                               -&gt; 3.1.8<br> * [new tag]             3.1.9                                               -&gt; 3.1.9<br> * [new tag]             3.2.0                                               -&gt; 3.2.0<br> * [new tag]             3.2.1                                               -&gt; 3.2.1<br> * [new tag]             3.2.10                                              -&gt; 3.2.10<br> * [new tag]             3.2.11                                              -&gt; 3.2.11<br> * [new tag]             3.2.12                                              -&gt; 3.2.12<br> * [new tag]             3.2.13                                              -&gt; 3.2.13<br> * [new tag]             3.2.14                                              -&gt; 3.2.14<br> * [new tag]             3.2.15                                              -&gt; 3.2.15<br> * [new tag]             3.2.16                                              -&gt; 3.2.16<br> * [new tag]             3.2.17                                              -&gt; 3.2.17<br> * [new tag]             3.2.2                                               -&gt; 3.2.2<br> * [new tag]             3.2.3                                               -&gt; 3.2.3<br> * [new tag]             3.2.4                                               -&gt; 3.2.4<br> * [new tag]             3.2.5                                               -&gt; 3.2.5<br> * [new tag]             3.2.6                                               -&gt; 3.2.6<br> * [new tag]             3.2.7                                               -&gt; 3.2.7<br> * [new tag]             3.2.8                                               -&gt; 3.2.8<br> * [new tag]             3.2.9                                               -&gt; 3.2.9<br> * [new tag]             3.3.0                                               -&gt; 3.3.0<br> * [new tag]             3.3.1                                               -&gt; 3.3.1<br> * [new tag]             3.3.10                                              -&gt; 3.3.10<br> * [new tag]             3.3.11                                              -&gt; 3.3.11<br> * [new tag]             3.3.12                                              -&gt; 3.3.12<br> * [new tag]             3.3.13                                              -&gt; 3.3.13<br> * [new tag]             3.3.14                                              -&gt; 3.3.14<br> * [new tag]             3.3.15                                              -&gt; 3.3.15<br> * [new tag]             3.3.16                                              -&gt; 3.3.16<br> * [new tag]             3.3.2                                               -&gt; 3.3.2<br> * [new tag]             3.3.3                                               -&gt; 3.3.3<br> * [new tag]             3.3.4                                               -&gt; 3.3.4<br> * [new tag]             3.3.5                                               -&gt; 3.3.5<br> * [new tag]             3.3.6                                               -&gt; 3.3.6<br> * [new tag]             3.3.7                                               -&gt; 3.3.7<br> * [new tag]             3.3.8                                               -&gt; 3.3.8<br> * [new tag]             3.3.9                                               -&gt; 3.3.9<br> * [new tag]             3.4.0                                               -&gt; 3.4.0<br> * [new tag]             3.4.1                                               -&gt; 3.4.1<br> * [new tag]             3.4.10                                              -&gt; 3.4.10<br> * [new tag]             3.4.11                                              -&gt; 3.4.11<br> * [new tag]             3.4.2                                               -&gt; 3.4.2<br> * [new tag]             3.4.3                                               -&gt; 3.4.3<br> * [new tag]             3.4.4                                               -&gt; 3.4.4<br> * [new tag]             3.4.5                                               -&gt; 3.4.5<br> * [new tag]             3.4.6                                               -&gt; 3.4.6<br> * [new tag]             3.4.7                                               -&gt; 3.4.7<br> * [new tag]             3.4.8                                               -&gt; 3.4.8<br> * [new tag]             3.4.9                                               -&gt; 3.4.9<br> * [new tag]             3.5.0                                               -&gt; 3.5.0<br> * [new tag]             3.5.1                                               -&gt; 3.5.1<br> * [new tag]             3.5.10                                              -&gt; 3.5.10<br> * [new tag]             3.5.2                                               -&gt; 3.5.2<br> * [new tag]             3.5.3                                               -&gt; 3.5.3<br> * [new tag]             3.5.4                                               -&gt; 3.5.4<br> * [new tag]             3.5.5                                               -&gt; 3.5.5<br> * [new tag]             3.5.6                                               -&gt; 3.5.6<br> * [new tag]             3.5.7                                               -&gt; 3.5.7<br> * [new tag]             3.5.8                                               -&gt; 3.5.8<br> * [new tag]             3.5.9                                               -&gt; 3.5.9<br> * [new tag]             3.6.0                                               -&gt; 3.6.0<br> * [new tag]             3.6.1                                               -&gt; 3.6.1<br> * [new tag]             3.6.10                                              -&gt; 3.6.10<br> * [new tag]             3.6.11                                              -&gt; 3.6.11<br> * [new tag]             3.6.12                                              -&gt; 3.6.12<br> * [new tag]             3.6.13                                              -&gt; 3.6.13<br> * [new tag]             3.6.14                                              -&gt; 3.6.14<br> * [new tag]             3.6.15                                              -&gt; 3.6.15<br> * [new tag]             3.6.16                                              -&gt; 3.6.16<br> * [new tag]             3.6.17                                              -&gt; 3.6.17<br> * [new tag]             3.6.18                                              -&gt; 3.6.18<br> * [new tag]             3.6.19                                              -&gt; 3.6.19<br> * [new tag]             3.6.2                                               -&gt; 3.6.2<br> * [new tag]             3.6.20                                              -&gt; 3.6.20<br> * [new tag]             3.6.3                                               -&gt; 3.6.3<br> * [new tag]             3.6.4                                               -&gt; 3.6.4<br> * [new tag]             3.6.5                                               -&gt; 3.6.5<br> * [new tag]             3.6.6                                               -&gt; 3.6.6<br> * [new tag]             3.6.7                                               -&gt; 3.6.7<br> * [new tag]             3.6.8                                               -&gt; 3.6.8<br> * [new tag]             3.6.9                                               -&gt; 3.6.9<br>HEAD is now at 1c85a717c Merge pull request #14421 from hyuraku/move_check_binary_arches-to-extend-os<br>==&gt; Tapping homebrew/core<br>remote: Enumerating objects: 1403417, done.<br>remote: Counting objects: 100% (386/386), done.<br>remote: Compressing objects: 100% (168/168), done.<br>remote: Total 1403417 (delta 226), reused 372 (delta 218), pack-reused 1403031<br>Receiving objects: 100% (1403417/1403417), 536.58 MiB | 2.95 MiB/s, done.<br>Resolving deltas: 100% (977583/977583), done.<br>From https://github.com/Homebrew/homebrew-core<br> * [new branch]              master     -&gt; origin/master<br>HEAD is now at ec65a6b9eac bash-language-server: update 4.6.0 bottle.<br>Warning: /opt/homebrew/bin is not in your PATH.<br>  Instructions on how to configure your shell for Homebrew<br>  can be found in the &#39;Next steps&#39; section below.<br>==&gt; Installation successful!<br><br>==&gt; Homebrew has enabled anonymous aggregate formulae and cask analytics.<br>Read the analytics documentation (and how to opt-out) here:<br>  https://docs.brew.sh/Analytics<br>No analytics data has been sent yet (nor will any be during this install run).<br><br>==&gt; Homebrew is run entirely by unpaid volunteers. Please consider donating:<br>  https://github.com/Homebrew/brew#donations<br><br>==&gt; Next steps:<br>- Run these three commands in your terminal to add Homebrew to your PATH:<br>    echo &#39;# Set PATH, MANPATH, etc., for Homebrew.&#39; &gt;&gt; /Users/karthikeyan/.zprofile<br>    echo &#39;eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;&#39; &gt;&gt; /Users/karthikeyan/.zprofile<br>    eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;<br>- Run brew help to get started<br>- Further documentation:<br>    https://docs.brew.sh</pre><p>The above output says that brew is installed but the path variable is not set in my machine, it also provides the commands to add the path variable.</p><p>Copy the commands from output and execute like below,</p><pre># echo &#39;# Set PATH, MANPATH, etc., for Homebrew.&#39; &gt;&gt; /Users/karthikeyan/.zprofile<br># echo &#39;eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;&#39; &gt;&gt; /Users/karthikeyan/.zprofile<br># eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;</pre><p>Verify the path whether it is added correctly,</p><pre># which brew<br>/opt/homebrew/bin/brew</pre><p>Once Homebrew is installed, can start to install the telnet client with the following command.</p><pre># brew install telnet<br>==&gt; Fetching telnet<br>==&gt; Downloading https://ghcr.io/v2/homebrew/core/telnet/manifests/64<br>######################################################################## 100.0%<br>==&gt; Downloading https://ghcr.io/v2/homebrew/core/telnet/blobs/sha256:cf76f3b47cf35efd4d271adf52227e463298005ec9b1ac586b629d5ad94522cf<br>==&gt; Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:cf76f3b47cf35efd4d271adf52227e463298005ec9b1ac586b629d5ad94522cf?se=2023-01-26T18%3A25%3A00Z&amp;sig=YVwwx%2FEglPVEjx0gsrb6aN7O6e3D%2Fwk%2BPEMjjTRju7M%3D&amp;sp=r&amp;spr=h<br>######################################################################## 100.0%<br>==&gt; Pouring telnet--64.arm64_monterey.bottle.tar.gz<br>🍺  /opt/homebrew/Cellar/telnet/64: 4 files, 175.2KB<br>==&gt; Running `brew cleanup telnet`...<br>Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.<br>Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).</pre><p>Verify the telnet command,</p><pre># telnet 18.214.102.244 22<br>Trying 18.234.102.243...<br>Connected to ec2-18-214-102-244.compute-1.amazonaws.com.<br>Escape character is &#39;^]&#39;.</pre><p>That&#39;s all folks, Happy learning!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Df9TOr_zZ49oNiFG.png" /></figure><h4>👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇</h4><h4>🚀<a href="http://from.faun.to/r/8zxxd">Join FAUN.dev() &amp; get similar stories in your inbox each week for free!</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f76c0483c8" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/install-brew-telnet-on-macos-5f76c0483c8">How to install homebrew/telnet on m1 macOS</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node Affinity in Kubernetes]]></title>
            <link>https://faun.pub/node-affinity-in-kubernetes-75777bf02adb?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/75777bf02adb</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Sat, 28 Mar 2020 13:04:49 GMT</pubDate>
            <atom:updated>2020-03-31T13:38:08.510Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pre-requisites:</h3><p>It is recommended that one should understand the <strong>Node Selectors</strong> and <strong>Taints and Tolerations</strong> concepts. Let me explain, by asking below question,</p><h3>How do you place a POD on a specific node?</h3><p>They are 3 ways to place a POD on a specific node,</p><blockquote>1. Node Selectors</blockquote><blockquote>2. Taints and Tolerations</blockquote><blockquote>3. Node Affinity</blockquote><p>But each method has its own advantages and disadvantages. So based on the use case we can use any one of the above methods to place POD on a node.</p><p><strong>Node Affinity </strong>is an advanced feature in Kubernetes when compared to the other two above methods.</p><p><strong>If you want to read about Node Selectors and Taints and Tolerations, please refer to the links below</strong></p><ul><li><a href="https://medium.com/faun/labels-and-node-selectors-6437ea397d96">Labels and Node Selectors</a></li><li><a href="https://medium.com/faun/taints-and-toleration-in-kubernetes-b85e8a5d482d">Taints and Toleration in Kubernetes</a></li></ul><p>But if you already have a good understanding of Node Selectors and Taints and Tolerations, then waste no more time, let’s jump into <strong>Node Affinity.</strong></p><h3>What is Node Affinity?</h3><p>The Node affinity provides advanced capabilities to limit pod placement on specific nodes.</p><p>Affinity is of 3 types such as node affinity, pod affinity and anti-affinity. It’s important to read these as properties of a pod.</p><h3>Why we need Node Affinity?</h3><p>If you want to restrict a POD to only specific nodes, then it can be achieved by <strong>’node affinity’.</strong></p><p><strong>Note: </strong>We cannot achieve this level of placement of PODs with Taints and Toleration and Node Selectors Methods.</p><h3>How to set Node Affinity?</h3><p>Let’s take an example, to understand the node affinity.</p><p><strong>Example:</strong></p><p>Assume that, you have 3 Worker nodes ‘node01’, ‘node02’, and ‘node03’ in the region ‘us-west-2’ and it is located on 3 different availability zones as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*te45npoK1I_gZp5M7XIBiQ.png" /></figure><p>Now, let’s consider some use cases which will help us to understand the node affinity.</p><h3>Case 1:</h3><p>Place your pod either on ‘us-west-1a’ OR ‘us-west-1b’ availability zone.</p><p><strong>Step 1: </strong>First, label the nodes like below,</p><ul><li>node01 to ‘us-west-1a’</li><li>node02 to ‘us-west-1b’</li><li>node03 to ‘us-west-1c’</li></ul><pre># kubectl label node node01 region=us-west-1a<br>node/node01 labeled</pre><pre># kubectl label node node02 region=us-west-1b<br>node/node02 labeled</pre><pre># kubectl label node node03 region=us-west-1b<br>node/node03 labeled</pre><p><strong>Step 2: </strong>Create the pod configuration with node affinity like below,</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: my-nginx-pod<br>  labels:<br>    region: us-west-1a<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx<br>  affinity:<br>   nodeAffinity:<br>    requiredDuringSchedulingIgnoredDuringExecution:<br>     nodeSelectorTerms:<br>     - matchExpressions:<br>       - key: region<br>         operator: In<br>         values:<br>         - us-west-1a<br>         - us-west-1b</pre><p>Create the pod,</p><pre># kubectl create -f my-nginx-pod.yaml<br>pod/my-nginx-pod created</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FAUQ7GNpUIuHH4VBZ3x61A.png" /></figure><p>Done, now the pod ‘my-Nginx-pod’ has been placed into ‘node01’ which is on ‘us-west-1a’ availability zone.</p><h3>Case 2:</h3><p>Create another Nginx pod, but this time make sure that the pod does not get created on ‘us-west-1a’ and ‘us-west-1b’ region.</p><p><strong>Step 1:</strong> Create the pod configuration with node affinity like below,</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: my-nginx-pod-2<br>  labels:<br>    region: us-west-1a<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx<br>  affinity:<br>   nodeAffinity:<br>    requiredDuringSchedulingIgnoredDuringExecution:<br>     nodeSelectorTerms:<br>     - matchExpressions:<br>       - key: region<br>         operator: NotIn<br>         values:<br>         - us-west-1a<br>         - us-west-1b</pre><p>Create the pod,</p><pre># kubectl create -f my-nginx-pod-2.yaml<br>pod/my-nginx-pod-2 created</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qLbfx9_wYeMVs0S8ehWdA.png" /></figure><p>Done, now the pod ‘my-Nginx-pod-2’ has been placed into ‘node03’ which is on ‘us-west-1c’ availability zone.</p><h3>Case 3:</h3><p>If you want to place your pod in any availability zone without any restrictions, then use the configuration like below,</p><p><strong>Step 1:</strong> Create the pod configuration with node affinity like below,</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: pod-anywhere<br>  labels:<br>    region: us-west-1a<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx<br>  affinity:<br>   nodeAffinity:<br>    requiredDuringSchedulingIgnoredDuringExecution:<br>     nodeSelectorTerms:<br>     - matchExpressions:<br>       - key: region<br>         operator: Exists</pre><p>Create the pod,</p><pre># kubectl create -f pod-anywhere.yaml<br>pod/pod-anywhere created</pre><p><strong>What does the Exists operator mean?</strong></p><p>Exists operator will simply check if the label<strong> ‘region’</strong> exists on the nodes, and you don’t need the values section for that, because it does not check the values.</p><p><strong>Note:</strong> There are many operators like this. Check the Kubernetes documentation.</p><p>Ok, Take a break or Grab your fav drink, if required :-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*cLOskwDOJD2FWB9xbYF7aQ.gif" /></figure><p>Ok, So far we have seen what is node affinity and how to implement them, now you might have thought below,</p><p><strong>‘What if someone removed the labels of the node ?’</strong></p><p><strong>Answer:</strong> We can use Node Affinity types.</p><h3>Types of Node Affinity</h3><p>There are 2 types of node affinity available at the moment,</p><blockquote>requiredDuringSchedulingIgnoredDuringExecution</blockquote><blockquote>preferredDuringSchedulingIgnoredDuringExecution</blockquote><p>Before jumping into these types, we have to understand the below key factors,</p><p><strong>What is DuringScheduling</strong></p><ul><li>In this state, the pod is NOT yet created and going to be created for the first time.</li><li>Usually when the pod is created the affinity rules will be applied to place the pod in the right nodes.</li></ul><p><strong>What is DuringExecution</strong></p><ul><li>In this state, the pod has been running and the change is made in the environment that affects nodeAffinity such as a change in the label of the node.</li></ul><p>Don’t worry if it is confusing, we will get the clarity by the end of this article, just keep going.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*GwmmzhL511OjCLxrVQWg_w.gif" /></figure><p>To understand the usage of Node Affinity types, let’s take 2 use cases,</p><h3>Case 1:</h3><p>You are trying to create a pod by using node affinity but the node does not have any label? What will happen?</p><p>So, if the node does NOT have any label, then we have 2 affinity types to consider while launching the pod,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cyOicd6j8Q3r7pHNvF6LSg.png" /></figure><ul><li>If you have used the above method, then the pod will not be placed on the node because the node does not have the labels.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cUp9iL6Eb_nuXt_uMLddlw.png" /></figure><ul><li>If you have used the above method, then even though the node does not have the label, the pod will be placed.</li></ul><h3>Case 2:</h3><p>Assume that the given pod is running on the node and someone removed the label “region” on the node. Now, what will happen to the PODs that are running on the node?</p><p>So, if someone removed the labels, then we have 2 affinity types to consider while launching the pod,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGznGMKAj9396bRZMrOySg.png" /></figure><p>If you have used the above <strong>‘required….’</strong> method, then the pod will still continue to run and the new changes will not impact the pod in anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVLE8A9q-12EFIPfCwojig.png" /></figure><p>If you have used the above <strong>‘preferred…’</strong> method, then the pod will still continue to run and the new changes will not impact the pod in any ways. Ideally both provide same results.</p><p>Because if you notice the second part in both type of affinity, it says <strong>“IgnoredDuringExecution”</strong> which means, “Pod will continue to run and any changes in node affinity will not impact them once they are scheduled”.</p><p>Finally, we came to the end, but there is one Node Affinity type which is not available right now but may come in future Kubernetes releases, please refer below type,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ImMaeHJdIhxBPc4Kynx0QA.png" /></figure><p>In this type, the pod will be removed from the node which does not have a label.</p><p>Basically, I <strong>LOVE</strong> this 3rd Node Affinity type than the 1st and 2nd types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*DdWU5QscaLrdUa32yPQQYQ.gif" /></figure><p>That is ALL Readers, thanks for your time. Happy Learning!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬<strong>.</strong></p><p><strong>To join our community Slack team chat </strong>🗣️ <strong>read our weekly Faun topics </strong>🗞️,<strong> and connect with the community </strong>📣<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P3WpLjGv5v1ucm5dgkucg.png" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75777bf02adb" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/node-affinity-in-kubernetes-75777bf02adb">Node Affinity in Kubernetes</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Labels and Node Selectors]]></title>
            <link>https://faun.pub/labels-and-node-selectors-6437ea397d96?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6437ea397d96</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 04:37:31 GMT</pubDate>
            <atom:updated>2020-03-26T13:01:50.925Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will learn about <strong><em>Labels, Selectors, Annotations </em></strong><em>and </em><strong><em>Node Selectors</em> </strong>in <em>Kubernetes. Hope I kept it simple as possible to understand :-)</em></p><p><strong>TIP: </strong>Use ‘Katacoda platform’ to practice the examples which we will be discussing in this article</p><p><a href="https://www.katacoda.com/courses/kubernetes/playground">Kubernetes Playground | Katacoda</a></p><h3><strong>What are Labels?</strong></h3><p><em>Labels</em> are key/value pairs that are attached to objects, such as pods.</p><p><em>Huh... Tired of these kinds of formal definitions?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*XEOp6Y6uBWPfMAlseyIhnA.gif" /></figure><p>Let me try to put it in the simplest forms, throughout the article,</p><blockquote><strong>Labels can be used to identify, or group the resources in Kubernetes.</strong></blockquote><p>But the problem with labels is, it doesn’t provide <strong><em>Uniqueness</em></strong>. Let me explain with an example,</p><p><strong>Example:</strong></p><p>Assume that, in your cluster ‘Multiple Pods have same label name.’</p><p><strong>In this case how you will call specific a Pod by using its label name?</strong></p><p>The answer is <strong>“Selectors”</strong>.</p><h3><strong>What are Selectors:</strong></h3><blockquote>Label selectors are the core grouping primitive in Kubernetes.</blockquote><p>Let’s understand with an example,</p><p><strong>Example:</strong> ‘Nginx’ — Deployment configuration</p><p>The below configuration will create a deployment with 3 Nginx pods, and the deployments use the labels to identify the ‘nginx’ pods running on the node.</p><p># vim dep.yaml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRKzM8qnJ-lNYxwS0I5l-Q.png" /></figure><p>Create the deployment,</p><pre># kubectl create -f dep.yaml<br>deployment.apps/nginx-deployment created</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*VhBSeqJVxXkBsSUL-oqygw.png" /></figure><p><strong>Note:</strong> If the ‘nginx’ pods are already there, then deployment will just group them into a deployment, else it will create 3 Nginx pods and then group them into a deployment called as ‘Nginx-deployment’.</p><p><strong>Thus, we used labels and selectors and created a deployment.</strong></p><h3>How to Create Labels?</h3><p>Create the below pod with labels defined in it,</p><p># vim my-pod.yaml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8Usll-ZnZTpa-anKyM9zg.png" /></figure><pre># kubectl create -f my-pod.yaml</pre><pre>kubectl create -f dep.yaml<br>deployment.apps/nginx-deployment created</pre><p>Verify the labels</p><pre># kubectl get pod my-pod --show-labels<br>NAME     READY   STATUS    RESTARTS   AGE    LABELS<br>my-pod   1/1     Running   0          116s   environment=<strong>staging,team=sre-team</strong></pre><pre>OR</pre><pre># kubectl describe pod my-pod |grep -A1 Labels:<br>Labels:             <strong>environment=staging<br>                    team=sre-team</strong></pre><p>Add a label <strong>‘versionID</strong>’ to the pod and verify it:</p><pre># kubectl label pod my-pod versionID=1.11<br>pod/my-pod labeled</pre><pre># kubectl describe pod my-pod |grep -A2 Labels:<br>Labels:             environment=staging<br>                    team=sre-team<br>                    <strong>versionID=1.11</strong></pre><p>Remove the label <strong>‘versionID’</strong> and verify it:</p><pre># kubectl label pod my-pod versionID-<br>pod/my-pod labeled</pre><pre># kubectl describe pod my-pod |grep -A2 Labels:<br>Labels:             environment=staging<br>                    team=sre-team<br>Annotations:        &lt;none&gt;</pre><p>Update a label and verify it:</p><pre># kubectl label --overwrite pods my-pod team=ops<br>pod/my-pod labeled</pre><pre># kubectl get pod my-pod --show-labels<br>NAME     READY   STATUS    RESTARTS   AGE     LABELS<br>my-pod   1/1     Running   0          7m51s   environment=staging,team=<strong>ops</strong></pre><h3>Recommended Labels to use for an Application:</h3><p>Create a more extensive list with labels that can provide more operability and context to your objects. Following is an exhaustive list of Kubernetes labels examples, along with their example values. Take your pick:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igLpmuXNKRNWXLZc9W4sMA.png" /></figure><h3>What are annotations?</h3><p>One word to explain <em>annotation</em> is <em>metadata</em>. Metadata means <strong><em>data about data.</em></strong></p><blockquote>Kubernetes annotations serve the purpose of providing non-identifying metadata which can be used to get more elaborate context for an object .</blockquote><h3>How to create annotations?</h3><p>Create the below pod with predefined annotations,</p><p># vim annotate.yaml</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: annotations-demo<br>  annotations:<br>    imageregistry: &quot;https://hub.docker.com/&quot;<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx:1.14.2</pre><p>Create the pod,</p><pre># kubectl create -f annotate.yaml</pre><pre>$ kubectl get pods<br>NAME               READY   STATUS    RESTARTS   AGE<br>annotations-demo   1/1     Running   0          94s</pre><p>View the annotations,</p><pre># kubectl describe pod annotations-demo|grep  Annotations:<br>Annotations:        <strong>imageregistry: </strong><a href="https://hub.docker.com/"><strong>https://hub.docker.com/</strong></a></pre><p>Add one more annotation to ‘annotations-demo’ pod and verify it,</p><pre># kubectl annotate pod annotations-demo oncallPage=800-555-1212<br>pod/annotations-demo annotated</pre><pre># kubectl describe pod annotations-demo|grep  -A1 Annotations:<br>Annotations:        imageregistry: <a href="https://hub.docker.com/">https://hub.docker.com/</a><br>                    <strong>oncallPage: 800-555-1212</strong></pre><h3><strong>What are Node Selectors and why do we need them?</strong></h3><blockquote>Node Selectors are used to place your pod on specific node.</blockquote><p>Yes, If you want to place your pod on a specific node, then the simple and easy method is to achieve that is by using the “nodeSelector”.</p><p>Assume that we have below cluster setup, where we have <strong>1 Master</strong> and <strong>2 Worker</strong> nodes.</p><pre># kubectl get nodes<br>NAME     STATUS   ROLES    AGE     VERSION<br>master   Ready    master   6h27m   v1.14.0<br>node01   Ready    &lt;none&gt;   6h27m   v1.14.0<br>node02   Ready    &lt;none&gt;   6h27m   v1.14.0</pre><p>There are 2 things required to use Node Selectors,</p><ol><li>Before using the nodeSelector, make sure you have <strong>labeled your pods</strong> because nodeSelectors works based on labels.</li><li>Then <strong>label your nodes</strong>.</li></ol><h4>1 — Label a node:</h4><p><strong>Syntax:</strong></p><pre># kubectl label node &lt;node-name&gt; &lt;label-key&gt;=&lt;label-value&gt;</pre><p><strong>Example:</strong></p><pre># kubectl label node node01 size=large<br>node/node01 labeled</pre><p>Verify the labels,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NNRGmJhiaB4UFl4vhJqmw.png" /></figure><p>Done, we have successfully labeled the <strong>‘node01&#39; </strong>as per the above output. Next, label the pod.</p><h4>2 — Label a pod:</h4><p>Now create the POD with the nodeSelector field in it like below,</p><p># vim labeled-pod.yaml</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: labeled-pod<br>spec:<br>  containers:<br>  - name: nginx-pod<br>    image: nginx<br>  nodeSelector:<br>    size: large</pre><p>Create the pod,</p><pre># kubectl create -f labeled-pod.yaml<br>pod/labeled-pod created</pre><p>Now you can see the ‘nginx-pod’ will be launched into ‘node1’,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49SGXgMj6SwNQLbnW_gvvg.png" /></figure><h3>The disadvantage of Node Selectors?</h3><blockquote>The Node Selectors does not support logical operators like <strong>AND</strong> and <strong>OR</strong>.</blockquote><p>What does that mean? Don’t worry, let’s understand with an example,</p><p><strong>Example:</strong></p><p>Assume that we have 4 nodes with different configuration as below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cmcc-aFbcToiRAhOuYnNGA.png" /></figure><p>Now consider the below cases to launch a pod one these nodes,</p><p><strong>Case 1:</strong> I want to launch the pod either on Large or Medium nodes.</p><p><strong>Case 2:</strong> I want to launch the pod only on Large or Medium but not Small.</p><p>This cannot be achieved in nodeSelectors. The solution for these types of cases is “Node Affinity”.</p><h3>What’s Next?</h3><p>Since Node selectors are a manual process of scheduling a pod on the node and it also does not support complex use cases like to place a pod on specific nodes. We can overcome these limitations by using Taints and tolerations.</p><p><strong>Taints and Tolerations </strong>work together to ensure that pods are not scheduled onto inappropriate nodes.</p><p>Please refer the below link to learn about Taints and Tolerations,</p><p><a href="https://medium.com/faun/taints-and-toleration-in-kubernetes-b85e8a5d482d">Taints and Toleration in Kubernetes</a></p><p>That’s it. As always, Happy learning!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬<strong>.</strong></p><p><strong>To join our community Slack team chat </strong>🗣️ <strong>read our weekly Faun topics </strong>🗞️,<strong> and connect with the community </strong>📣<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P3WpLjGv5v1ucm5dgkucg.png" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6437ea397d96" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/labels-and-node-selectors-6437ea397d96">Labels and Node Selectors</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Taints and Toleration in Kubernetes]]></title>
            <link>https://faun.pub/taints-and-toleration-in-kubernetes-b85e8a5d482d?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b85e8a5d482d</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 04:30:17 GMT</pubDate>
            <atom:updated>2021-01-13T05:37:12.606Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Taints and Tolerations ?</h3><blockquote>The taint is a labeled thing set on the nodes that has to be matched by a toleration from POD side, period.</blockquote><ul><li>The taints and toleration are all about the relationship between the pod and node.</li><li>Taints and Toleration will tell what pods can be placed on what nodes.</li></ul><h3>Why we need Taints and Tolerations?</h3><ul><li>Taints and tolerations will ensure that a given Pod does not end up on the inappropriate node.</li><li>If the taint is applied to a node, only those Pods that have tolerations for this taint can be scheduled onto that node.</li></ul><p>Before going forward, let’s assume that we have one <strong>Master</strong> node and one <strong>Worker</strong> node, where we will be launching the Nginx <strong>POD</strong> by using Taints and Toleration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OydwBzeln2q7DJKppEuCMg.png" /></figure><p>Things we will cover in this article,</p><blockquote>1. How to set the Taint</blockquote><blockquote>2. How to verify the Taint</blockquote><blockquote>3. Launch the nginx POD on the Tainted node and see what happens</blockquote><blockquote>4. Set the Toleration on nginx POD</blockquote><blockquote>5. Remove the Taint</blockquote><blockquote>6. Key points to remember</blockquote><h3>1. How to set a Taint on the node?</h3><h4><strong>Syntax:</strong></h4><pre>kubectl taint nodes [NODE_NAME] [KEY]=[VALUE]:[EFFECT]</pre><h4><strong>Example — On Master Node:</strong></h4><pre>root@ip-172–31–56–82:~# kubectl get nodes<br>NAME STATUS ROLES AGE VERSION<br>ip-172–31–51–231 Ready &lt;none&gt; 34d v1.17.2<br>ip-172–31–56–82 Ready master 34d v1.17.2</pre><pre>root@ip-172–31–56–82:~# kubectl taint node ip-172-31-51-231 app=uber:NoSchedule<br>node/ip-172-31-51-231 tainted</pre><p>There are 3 types of taint effects,</p><ol><li><strong><em>NoSchedule = </em></strong>PODs will not be scheduled on the node.</li><li><strong>P<em>referNoSchedule = </em></strong>Kubernetes will try not to place the pod on the node, but it is not guaranteed.</li><li><strong><em>NoExecute = </em></strong>New pods will not be placed on the node and the existing will be moved out if those could not tolerate the current taint rule.</li></ol><h3>2. How to verify the Taint?</h3><p>Use the kubectl command and grep for “Taint”,</p><h4><strong>Syntax:</strong></h4><pre># kubectl describe node &lt;node-name&gt;| grep Taints:</pre><h4><strong>Example:</strong></h4><pre>root@ip-172-31-56-82:~# kubectl describe node ip-172-31-51-231 |grep Taints:<br>Taints:             app=uber:NoSchedule</pre><h3>3. Launch the Nginx POD on the Tainted node and see what happens</h3><p>In the above section, we had set up Taint on the node “IP-172–31–51–231”. If you try to launch the Nginx POD now, then the POD will go into PENDING state.</p><p><strong>On the Master Node:</strong></p><p>Create an NGINX pod configuration file,</p><pre># vim nginx.yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: nginx<br>  labels:<br>    env: test<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx<br>    imagePullPolicy: IfNotPresent</pre><p>Save and close the file, and run below command to create the pod,</p><pre>root@ip-172-31-56-82:~# kubectl get pods<br>NAME                       READY   STATUS    RESTARTS   AGE<br><br>nginx                      0/1     <strong>Pending</strong>   0          5s</pre><p>Here, the POD will be in <strong>PENDING</strong> state, because we have only one worker node, and we tainted the worker node as <strong>“NoSchedule”</strong> which means no POD can be launched into it unless it has matching toleration.</p><pre>Events:<br>Type     Reason            Age        From               Message<br>----     ------            ----       ----               -------<br>Warning  FailedScheduling  &lt;unknown&gt;  default-scheduler  0/2 nodes are available: <strong>2 node(s) had taints that the pod didn&#39;t tolerate.</strong></pre><p>If you see logs of the Nginx pod, it says nodes are <strong>NOT</strong> available, which means both the Master and Worker nodes are Tainted so the Nginx POD cannot be placed in either of them.</p><p><strong>Note: </strong>By default, Kubernetes Master node will be tainted with the “NoSchedule” effect.</p><h3>4. How to set Toleration?</h3><p>So in order to launch the Nginx POD, let’s set the Toleration on Nginx POD like below,</p><pre># vim nginx.yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: nginx<br>  labels:<br>    env: test<br>spec:<br>  containers:<br>  - name: nginx<br>    image: nginx<br>  tolerations:<br>  - key: &quot;app&quot;<br>    operator: &quot;Exists&quot;<br>    effect: &quot;NoSchedule&quot;</pre><p>A toleration “matches” a taint if the keys are the same and the effects are the same, and:</p><ul><li>the operator is Exists (in which case no value should be specified), or</li><li>the operator is Equal and the values are equal</li></ul><p><strong>Note:</strong> Operator defaults to Equal if not specified.</p><h4><strong>Verification:</strong></h4><p>Now check the POD status, it should be placed on the node “ip-172–31–51–231”,</p><pre>root@ip-172-31-56-82:~# kubectl get pods -o wide<br>NAME                       READY   STATUS    RESTARTS   AGE     IP            NODE               NOMINATED NODE   READINESS GATES<br><br>nginx                      1/1     <strong>Running</strong>   0          3m44s   10.244.1.83   ip-172-31-51-231   &lt;none&gt;           &lt;none&gt;<br></pre><h3>5. How to remove Taint on the node?</h3><p>To remove the taint, you have to use the [KEY] and [EFFECT] ending with [-].</p><p>In the above example, we have used KEY=app, VALUE=uber and EFFECT=NoSchedule, so use these values like below to remove the taint,</p><h4>Syntax:</h4><pre>kubectl taint nodes &lt;node-name&gt; [KEY]:[EFFECT]-</pre><h4>Example — On Master node:</h4><pre>root@ip-172–31–56–82:~# kubectl taint nodes ip-172-31-51-231 app:NoSchedule-<br>node/ip-172-31-51-231 untainted</pre><pre>root@ip-172-31-56-82:~# kubectl describe node ip-172-31-51-231 |grep Taints:<br>Taints:             &lt;none&gt;</pre><h3>6. Key Points to Remember:</h3><ul><li>Taints are set on ‘Nodes’ and Toleration level is set on ‘Pods’.</li><li>By default, pods are not tolerant of Taints.</li><li>Taint and Toleration do not tell the POD to go to a particular node instead it tells the NODE to only accept pods with a certain tolerance. So in this case, suppose if a node does not have any taint, then it is possible that a pod that has toleration set will land on the untainted node. There is no guarantee that all pods which have toleration set will land on tainted nodes, it might also land on untainted nodes.</li><li>If you want to restrict a POD to specific nodes(Only tainted), then it can be achieved by another concept called <strong>’node affinity’.</strong></li><li>Assume node-1 exists and inside that pod-1 and pod-2 is running without any Taint and Toleration. Now if you add Taint to node-1 and set toleration to pod-1, then pod-1 will continue to run on node-1 but pod-2 might become intolerant and will be killed.</li></ul><h3>What’s next?</h3><p><strong>Node affinity</strong> is a way to set rules based on which the scheduler can select the nodes for scheduling workload. Node affinity can be thought of as the opposite of taints. Taints repel a certain set of nodes whereas node affinity attracts a certain set of nodes.</p><p>To understand the Node affinity please refer this article,<br><a href="https://medium.com/faun/node-affinity-in-kubernetes-75777bf02adb">https://medium.com/faun/node-affinity-in-kubernetes-75777bf02adb</a></p><p>Happy learning folks!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬<strong>.</strong></p><p><strong>To join our community Slack team chat </strong>🗣️ <strong>read our weekly Faun topics </strong>🗞️,<strong> and connect with the community </strong>📣<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P3WpLjGv5v1ucm5dgkucg.png" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b85e8a5d482d" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/taints-and-toleration-in-kubernetes-b85e8a5d482d">Taints and Toleration in Kubernetes</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a Kubernetes cluster on Ubuntu 18.04]]></title>
            <link>https://medium.com/@karthikeyan_krishnaswamy/setting-up-a-kubernetes-cluster-on-ubuntu-18-04-4a89c74420f9?source=rss-460f438d637d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a89c74420f9</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Karthi Keyan]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 12:13:15 GMT</pubDate>
            <atom:updated>2019-12-09T01:34:12.235Z</atom:updated>
            <content:encoded><![CDATA[<h3>System Requirements:</h3><p>Install Ubuntu 18.04 on three machines by using Virtualbox, the system requirements should be as follows,</p><pre>Kubernetes Master Node:</pre><pre>VCPU = 2<br>Memory 2 GB<br>Hostname = k8-master (optional)<br>Network Adapter: Bridge Networking<br>Static IP: 192.168.0.100/24</pre><pre>Kubernetes Client Node 1:</pre><pre>VCPU = 1<br>Memory = 1 GB<br>Hostname = k8-node1 (optional)<br>Network Adapter: Bridge Networking<br>Static IP: 192.168.0.101/24</pre><pre>Kubernetes Client Node 2:</pre><pre>VCPU = 1<br>Memory = 1 GB<br>Hostname = k8-node2 (optional)<br>Network Adapter: Bridge Networking<br>Static IP: 192.168.0.103/24</pre><p><strong>Note: </strong>Why we are setting STATIC IP ?</p><p>If you want to work/use the Kubernetes cluster which we are going to create across reboots then set the static IP addresses, so that the nodes in cluster know each other even after the reboot.</p><p>Here is the basic architecture diagram of what we are going to create in this article,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*sunrixOMahkCEA3g" /></figure><h3>Purpose of packages:</h3><p>Kubeadm — is just an additional tool that simplifies the process setting up kubernetes cluster.</p><p>Kubectl — is a command line tool that we can use to interact with the cluster.</p><p>Kubelet — is an agent that manages the process of running containers on each node</p><h3>Step 1:</h3><h3>Install Docker on k8-node1, k8-node2 and k8-master node</h3><pre># sudo apt install curl vim net-tools openssh-server</pre><pre># sudo swapoff /swapfile</pre><pre># sudo curl -fsSL <a href="https://download.docker.com/linux/ubuntu/gpg">https://download.docker.com/linux/ubuntu/gpg</a> | sudo apt-key add -</pre><pre># sudo add-apt-repository \</pre><pre>   &quot;deb [arch=amd64] <a href="https://download.docker.com/linux/ubuntu">https://download.docker.com/linux/ubuntu</a> \</pre><pre>   $(lsb_release -cs) \</pre><pre>   stable&quot;</pre><pre># sudo apt-get update</pre><pre># sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu</pre><pre># sudo apt-mark hold docker-ce</pre><p>Follow the above commands on all three nodes.</p><p>Then, Verify the docker installation on all of them,</p><pre># sudo docker version</pre><h3>Step 2:</h3><h3>Install Kubeadm, Kubelet and Kubectl on k8-node1, k8-node2 and k8-master node</h3><pre># sudo curl -s <a href="https://packages.cloud.google.com/apt/doc/apt-key.gpg">https://packages.cloud.google.com/apt/doc/apt-key.gpg</a> | sudo apt-key add -</pre><pre># cat &lt;&lt; EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list</pre><pre>deb <a href="https://apt.kubernetes.io/">https://apt.kubernetes.io/</a> kubernetes-xenial main</pre><pre>EOF</pre><pre># cat /etc/apt/sources.list.d/kubernetes.list</pre><pre>deb <a href="https://apt.kubernetes.io/">https://apt.kubernetes.io/</a> kubernetes-xenial main</pre><pre># sudo apt-get update</pre><pre># sudo apt-get install -y kubelet=1.12.7-00 kubeadm=1.12.7-00 kubectl=1.12.7-00</pre><pre># sudo apt-mark hold kubelet kubeadm kubectl</pre><p>Follow the above commands on all three nodes.</p><p>After installing these components, verify that Kubeadm is working by getting the version info.</p><pre># sudo kubeadm version</pre><p><strong>Note:</strong></p><p>At this point, only “kubeadm version” will work, the other two commands “kubectl version” and “kubelet version” will not work.</p><h3>Step 3:</h3><h3>Bootstrapping the cluster:</h3><p>Now we will bootstrap the cluster on the Kube master node. Then, we will join each of the two worker nodes to the cluster, forming an actual multi-node Kubernetes cluster.</p><p>On the Kube master node(k8-master), initialize the cluster:</p><pre># sudo kubeadm init --pod-network-cidr=10.244.0.0/16</pre><p>Note: For any reason if the above command fails, then you have to reset the config by using below command, before you initiate the new cluster process again.</p><pre># sudo kubeadm reset</pre><p>When it is done, set up the local kubeconfig:</p><pre>karthi@k8-master:~$ mkdir -p $HOME/.kube</pre><pre>karthi@k8-master:~$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config</pre><pre>karthi@k8-master:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config<br></pre><pre>karthi@k8-master:~$ ls -l $HOME/.kube/config</pre><pre>-rw------- 1 karthi karthi 5449 Dec  2 12:34 /home/karthi/.kube/config</pre><p>Verify that the cluster is responsive and that Kubectl is working:</p><pre># sudo kubectl version</pre><p>You should get Server Version as well as Client Version. It should look something like this:</p><pre>karthi@k8-master:~$ sudo kubectl version</pre><pre>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;12&quot;, GitVersion:&quot;v1.12.7&quot;, GitCommit:&quot;6f482974b76db3f1e0f5d24605a9d1d38fad9a2b&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2019-03-25T02:52:13Z&quot;, GoVersion:&quot;go1.10.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}</pre><pre>Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;12&quot;, GitVersion:&quot;v1.12.10&quot;, GitCommit:&quot;e3c134023df5dea457638b614ee17ef234dc34a6&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2019-07-08T03:40:54Z&quot;, GoVersion:&quot;go1.10.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64”}</pre><p>The kubeadm init command should output a kubeadm join command containing a token and hash. Copy that command and run on both worker nodes.</p><h3>Step 4:</h3><h3>Connect the client nodes to Master</h3><p>On Node — 1(k8-node1):</p><pre>karthi@k8-node2:~$ sudo kubeadm join 192.168.0.100:6443 --token 2wr5dj.ew1h24xlc6ng0swa --discovery-token-ca-cert-hash sha256:c8b61afecb11dcb9b01147169da79714c472aace219faa5fa1ee383a9a21e1f4</pre><pre>[sudo] password for karthi:</pre><pre>[preflight] running pre-flight checks</pre><pre>    [WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs_rr ip_vs_wrr ip_vs_sh ip_vs] or no builtin kernel ipvs support: map[nf_conntrack_ipv4:{} ip_vs:{} ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{}]</pre><pre>you can solve this problem with following methods:</pre><pre>1. Run &#39;modprobe -- &#39; to load missing kernel modules;</pre><pre>2. Provide the missing builtin kernel ipvs support<br></pre><pre>[discovery] Trying to connect to API Server &quot;192.168.0.100:6443&quot;</pre><pre>[discovery] Created cluster-info discovery client, requesting info from &quot;https://192.168.0.110:6443&quot;</pre><pre>[discovery] Requesting info from &quot;https://192.168.0.100:6443&quot; again to validate TLS against the pinned public key</pre><pre>[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server &quot;192.168.0.100:6443&quot;</pre><pre>[discovery] Successfully established connection with API Server &quot;192.168.0.100:6443&quot;</pre><pre>[kubelet] Downloading configuration for the kubelet from the &quot;kubelet-config-1.12&quot; ConfigMap in the kube-system namespace</pre><pre>[kubelet] Writing kubelet configuration to file &quot;/var/lib/kubelet/config.yaml&quot;</pre><pre>[kubelet] Writing kubelet environment file with flags to file &quot;/var/lib/kubelet/kubeadm-flags.env&quot;</pre><pre>[preflight] Activating the kubelet service</pre><pre>[tlsbootstrap] Waiting for the kubelet to perform the TLS Bootstrap...</pre><pre>[patchnode] Uploading the CRI Socket information &quot;/var/run/dockershim.sock&quot; to the Node API object &quot;k8-node2&quot; as an annotation</pre><pre>This node has joined the cluster:</pre><pre>* Certificate signing request was sent to apiserver and a response was received.</pre><pre>* The Kubelet was informed of the new secure connection details.</pre><pre>Run &#39;kubectl get nodes&#39; on the master to see this node join the cluster.</pre><p><strong>Note:</strong> For any reason if the above command fails, then run ’sudo kubeadm reset’ and try to join to cluster again.</p><p>On Node — 2(k8-node2):</p><pre>karthi@k8-node1:~$ sudo kubeadm join 192.168.0.100:6443 --token 2wr5dj.ew1h24xlc6ng0swa --discovery-token-ca-cert-hash sha256:c8b61afecb11dcb9b01147169da79714c472aace219faa5fa1ee383a9a21e1f4</pre><pre>[sudo] password for karthi:</pre><pre>[preflight] running pre-flight checks</pre><pre>    [WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs_wrr ip_vs_sh ip_vs ip_vs_rr] or no builtin kernel ipvs support: map[ip_vs:{} ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{}]</pre><pre>you can solve this problem with following methods:</pre><pre>1. Run &#39;modprobe -- &#39; to load missing kernel modules;</pre><pre>2. Provide the missing builtin kernel ipvs support<br></pre><pre>[discovery] Trying to connect to API Server &quot;192.168.0.100:6443&quot;</pre><pre>[discovery] Created cluster-info discovery client, requesting info from &quot;https://192.168.0.100:6443&quot;</pre><pre>[discovery] Requesting info from &quot;https://192.168.0.100:6443&quot; again to validate TLS against the pinned public key</pre><pre>[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server &quot;192.168.0.100:6443&quot;</pre><pre>[discovery] Successfully established connection with API Server &quot;192.168.0.100:6443&quot;</pre><pre>[kubelet] Downloading configuration for the kubelet from the &quot;kubelet-config-1.12&quot; ConfigMap in the kube-system namespace</pre><pre>[kubelet] Writing kubelet configuration to file &quot;/var/lib/kubelet/config.yaml&quot;</pre><pre>[kubelet] Writing kubelet environment file with flags to file &quot;/var/lib/kubelet/kubeadm-flags.env&quot;</pre><pre>[preflight] Activating the kubelet service</pre><pre>[tlsbootstrap] Waiting for the kubelet to perform the TLS Bootstrap...</pre><pre>[patchnode] Uploading the CRI Socket information &quot;/var/run/dockershim.sock&quot; to the Node API object &quot;k8-node1&quot; as an annotation</pre><pre>This node has joined the cluster:</pre><pre>* Certificate signing request was sent to apiserver and a response was received.</pre><pre>* The Kubelet was informed of the new secure connection details.</pre><pre>Run &#39;kubectl get nodes&#39; on the master to see this node join the cluster.</pre><p><strong>Note:</strong> For any reason if the above command fails, then run ’sudo kubeadm reset’ and try to join to cluster again.</p><p>Now from Master node, we can verify that all nodes have successfully joined the cluster:</p><pre>karthi@k8-master:~$ sudo kubectl get nodes</pre><pre>NAME        STATUS     ROLES    AGE     VERSION<br>k8-master   NotReady   master   7m18s   v1.12.7<br>k8-node1    NotReady   &lt;none&gt;   2m14s   v1.12.7</pre><pre>k8-node2    NotReady   &lt;none&gt;   2m24s   v1.12.7</pre><p><strong>Note:</strong> The nodes are expected to have a STATUS of NotReady at this point.</p><h3>Step 5:</h3><h3>Configuring Networking:</h3><p>At his point, we have setup the Kubernetes cluster, but we still need to configure cluster networking in order to make the cluster fully functional.</p><p>On all 3 nodes(k8-master, k8-node1, k8-node2), run the following:</p><pre># echo &quot;net.bridge.bridge-nf-call-iptables=1&quot; | sudo tee -a /etc/sysctl.conf</pre><pre># sudo sysctl -p</pre><p>Install Flannel in the cluster by running this only on the Master node:</p><pre>karthi@k8-master:~$ kubectl apply -f <a href="https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml">https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml</a></pre><pre>clusterrole.rbac.authorization.k8s.io/flannel created</pre><pre>clusterrolebinding.rbac.authorization.k8s.io/flannel created</pre><pre>serviceaccount/flannel created</pre><pre>configmap/kube-flannel-cfg created</pre><pre>daemonset.extensions/kube-flannel-ds-amd64 created</pre><pre>daemonset.extensions/kube-flannel-ds-arm64 created</pre><pre>daemonset.extensions/kube-flannel-ds-arm created</pre><pre>daemonset.extensions/kube-flannel-ds-ppc64le created<br></pre><pre>daemonset.extensions/kube-flannel-ds-s390x created</pre><p>It may take a minute for all nodes to become Ready status, using the below command to verify,</p><pre>karthi@k8-master:~$ kubectl get nodes<br>NAME        STATUS   ROLES    AGE   VERSION<br>k8-master   Ready    master   16m   v1.12.7\<br>k8-node1    Ready    &lt;none&gt;   11m   v1.12.7</pre><pre>k8-node2    Ready    &lt;none&gt;   11m   v1.12.7</pre><p>Also verify the Flannel pods are up and running. Run the below command to get a list of system pods:</p><pre>karthi@k8-master:~$ kubectl get pods -n kube-system</pre><pre>NAME                                READY   STATUS    RESTARTS   AGE</pre><pre>coredns-bb49df795-ctml4             1/1     Running   0          16m</pre><pre>coredns-bb49df795-dt9md             1/1     Running   0          16m</pre><pre>etcd-k8-master                      1/1     Running   0          16m</pre><pre>kube-apiserver-k8-master            1/1     Running   0          15m</pre><pre>kube-controller-manager-k8-master   1/1     Running   0          15m</pre><pre>kube-flannel-ds-amd64-4zmr4         1/1     Running   0          87s</pre><pre>kube-flannel-ds-amd64-khdqn         1/1     Running   0          87s</pre><pre>kube-flannel-ds-amd64-qv2ph         1/1     Running   0          87s</pre><pre>kube-proxy-hmk7d                    1/1     Running   0          16m</pre><pre>kube-proxy-qqdpp                    1/1     Running   0          12m</pre><pre>kube-proxy-rrj75                    1/1     Running   0          12m<br></pre><pre>kube-scheduler-k8-master            1/1     Running   0          16m</pre><p>So there are 3 pods with flannel in the name, and all three should have a status of Running.</p><p>That’s all Folks, we have configured fully functional Kubernetes Cluster Up and Running.</p><p>Happy Learning!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a89c74420f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>