<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hyo</title>
    <description>The latest articles on DEV Community by Hyo (@hyohung).</description>
    <link>https://dev.to/hyohung</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F648599%2F9129e6eb-9964-4faf-8818-694399819271.jpeg</url>
      <title>DEV Community: Hyo</title>
      <link>https://dev.to/hyohung</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hyohung"/>
    <language>en</language>
    <item>
      <title>Setup local k8s cluster using kind</title>
      <dc:creator>Hyo</dc:creator>
      <pubDate>Tue, 18 Oct 2022 00:36:09 +0000</pubDate>
      <link>https://dev.to/hyohung/setup-simple-kind-cluster-19jp</link>
      <guid>https://dev.to/hyohung/setup-simple-kind-cluster-19jp</guid>
      <description>&lt;p&gt;In k8s world, there is a need for testing before going production. One among them is using &lt;code&gt;kind&lt;/code&gt; to build local cluster. &lt;br&gt;
There are many ways in &lt;a href="https://kind.sigs.k8s.io/docs/user/quick-start/"&gt;official document&lt;/a&gt;, here is my prefer way using yaml to define my expectation. &lt;/p&gt;

&lt;p&gt;Creating a yaml file named &lt;code&gt;kind.yaml&lt;/code&gt; as below to configure 1 master and 2 workers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
  image: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047
  extraPortMappings:
  - containerPort: 30778
    hostPort: 30778
    listenAddress: "0.0.0.0"
    protocol: tcp
- role: worker
  image: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047
- role: worker
  image: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install kind if not have. If you're using MacOS, run: &lt;code&gt;brew install kind&lt;/code&gt; for package manager using brewk&lt;/p&gt;

&lt;p&gt;Run command to setup cluster: &lt;code&gt;kind create cluster --name local --config kind.yaml&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Here is my result, tested in Mac M1 chip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind create cluster --name local --config kind.yaml
Creating cluster "local" ...
 ✓ Ensuring node image (kindest/node:v1.22.0) 🖼 
 ✓ Preparing nodes 📦 📦 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Joining worker nodes 🚜 
Set kubectl context to "kind-local"
You can now use your cluster with:

kubectl cluster-info --context kind-local

Have a nice day! 👋
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With k8s contents as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl config set-context local-kind                                           Context "local-kind" created.

kubectl get node                                                                  
NAME                  STATUS   ROLES                  AGE     VERSION
local-control-plane   Ready    control-plane,master   7m58s   v1.22.0
local-worker          Ready    &amp;lt;none&amp;gt;                 7m26s   v1.22.0
local-worker2         Ready    &amp;lt;none&amp;gt;                 7m26s   v1.22.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
