<?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: ido bistry</title>
    <description>The latest articles on DEV Community by ido bistry (@idubi).</description>
    <link>https://dev.to/idubi</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%2F823937%2F85a9e6ff-7e58-4d30-8011-a6c3323242e1.png</url>
      <title>DEV Community: ido bistry</title>
      <link>https://dev.to/idubi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/idubi"/>
    <language>en</language>
    <item>
      <title>Idubi</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Wed, 12 Nov 2025 07:52:38 +0000</pubDate>
      <link>https://dev.to/idubi/idubi-37c3</link>
      <guid>https://dev.to/idubi/idubi-37c3</guid>
      <description></description>
    </item>
    <item>
      <title>PODS CHEAT SHEET</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Sun, 04 May 2025 01:17:11 +0000</pubDate>
      <link>https://dev.to/idubi/pods-cheat-sheet-36an</link>
      <guid>https://dev.to/idubi/pods-cheat-sheet-36an</guid>
      <description>&lt;h1&gt;
  
  
  PODS CHEAT SHEET
&lt;/h1&gt;

&lt;h2&gt;
  
  
  40 Days of K8s – CKA Challenge (07/40)
&lt;/h2&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=_f9ql2Y5Xcc&amp;amp;ab_channel=TechTutorialswithPiyush" rel="noopener noreferrer"&gt;Day 7/40 - Pod In Kubernetes Explained | Imperative VS Declarative Way | YAML Tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  this suimmery include of 2 issues :
&lt;/h1&gt;

&lt;h3&gt;
  
  
  1. POD  - cheat sheet
&lt;/h3&gt;

&lt;h3&gt;
  
  
  2. EXERCISE from lecture
&lt;/h3&gt;




&lt;h1&gt;
  
  
  1. POD  - cheat sheet
&lt;/h1&gt;

&lt;h2&gt;
  
  
  CREATE POD
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Two Ways To Use KUBCTL to create POD:
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. imperative :
&lt;/h3&gt;




&lt;p&gt;create nginx deployment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl run nginx &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nginx 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. declerative :
&lt;/h3&gt;




&lt;h3&gt;
  
  
  - create nginx yaml file:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; #### template pod yaml has  : 

&lt;ul&gt;
&lt;li&gt;apiVersion&lt;/li&gt;
&lt;li&gt;kind&lt;/li&gt;
&lt;li&gt;metadata&lt;/li&gt;
&lt;li&gt;spec
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# nginx-pod-1.yaml&lt;/span&gt;
&lt;span class="c1"&gt;# template pod yaml hasa : apiVersion, kind, metadata, spec&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx-pod-1&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;demo&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;frontend&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx-container&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx:1.28&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;128Mi"&lt;/span&gt;
        &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;500m"&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
        &lt;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TCP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  - execute the yaml file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#kubectl apply/create -f &amp;lt;file-name&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;# create - oly on creation &lt;/span&gt;
  &lt;span class="c"&gt;# apply  - create or update changes on a pod&lt;/span&gt;
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; ./nginx-pod-1.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  To get the real values used in yaml file
&lt;/h3&gt;

&lt;h3&gt;
  
  
  to cretate a resource (pod,service ... ):
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;command used : &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;kubectl explain _[api-resouce-type]&lt;/strong&gt;_ &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;api-resouce-type type can be &lt;em&gt;pod/service/deployment/replicaset...&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl api-resources  
&lt;span class="c"&gt;# --&amp;gt; will show all of the resources that this command cover :&lt;/span&gt;

&lt;span class="c"&gt;#     kubectl explain pod --recursive&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   NAME                                SHORTNAMES   APIVERSION                        NAMESPACED   KIND&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   bindings                                         v1                                true         Binding&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   componentstatuses                   cs           v1                                false        ComponentStatus&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   configmaps                          cm           v1                                true         ConfigMap&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   endpoints                           ep           v1                                true         Endpoints&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   events                              ev           v1                                true         Event&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   limitranges                         limits       v1                                true         LimitRange&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   namespaces                          ns           v1                                false        Namespace&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   nodes                               no           v1                                false        Node&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   persistentvolumeclaims              pvc          v1                                true         PersistentVolumeClaim&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   persistentvolumes                   pv           v1                                false        PersistentVolume&lt;/span&gt;
&lt;span class="c"&gt;# --  &amp;gt;   pods                                po           v1                                true         Pod&lt;/span&gt;
&lt;span class="c"&gt;#  ....&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  so :
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  kubectl explain pod 

           &lt;span class="c"&gt;#  KIND:       Pod&lt;/span&gt;
           &lt;span class="c"&gt;#  VERSION:    v1&lt;/span&gt;
           &lt;span class="c"&gt;#  &lt;/span&gt;
           &lt;span class="c"&gt;#  DESCRIPTION:&lt;/span&gt;
           &lt;span class="c"&gt;#      Pod is a collection of containers that can run on a host. This resource is&lt;/span&gt;
           &lt;span class="c"&gt;#      created by clients and scheduled onto hosts.&lt;/span&gt;
           &lt;span class="c"&gt;#      &lt;/span&gt;
           &lt;span class="c"&gt;#  FIELDS:&lt;/span&gt;
           &lt;span class="c"&gt;#    apiVersion    &amp;lt;string&amp;gt;&lt;/span&gt;
           &lt;span class="c"&gt;#      APIVersion defines the versioned schema of this representation of an object.&lt;/span&gt;
           &lt;span class="c"&gt;#      Servers should convert recognized schemas to the latest internal value, and&lt;/span&gt;
           &lt;span class="c"&gt;#      may reject unrecognized values. More info:&lt;/span&gt;
           &lt;span class="c"&gt;#      https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources&lt;/span&gt;
           &lt;span class="c"&gt;#  &lt;/span&gt;
           &lt;span class="c"&gt;#    kind  &amp;lt;string&amp;gt;&lt;/span&gt;
           &lt;span class="c"&gt;#      Kind is a string value representing the REST resource this object&lt;/span&gt;
           &lt;span class="c"&gt;#      represents. Servers may infer this from the endpoint the client submits&lt;/span&gt;
           &lt;span class="c"&gt;#      requests to. Cannot be updated. In CamelCase. More info:&lt;/span&gt;
           &lt;span class="c"&gt;#      https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds&lt;/span&gt;
           &lt;span class="c"&gt;#  &lt;/span&gt;
           &lt;span class="c"&gt;#    metadata      &amp;lt;ObjectMeta&amp;gt;&lt;/span&gt;
           &lt;span class="c"&gt;#      Standard object's metadata. More info:&lt;/span&gt;
           &lt;span class="c"&gt;#      https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata&lt;/span&gt;
           &lt;span class="c"&gt;#  &lt;/span&gt;
           &lt;span class="c"&gt;#    spec  &amp;lt;PodSpec&amp;gt;&lt;/span&gt;
           &lt;span class="c"&gt;#      Specification of the desired behavior of the pod. More info:&lt;/span&gt;
           &lt;span class="c"&gt;#      https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status&lt;/span&gt;
           &lt;span class="c"&gt;#  &lt;/span&gt;
           &lt;span class="c"&gt;#    status        &amp;lt;PodStatus&amp;gt;&lt;/span&gt;
           &lt;span class="c"&gt;#      Most recently observed status of the pod. This data may not be up to date.&lt;/span&gt;
           &lt;span class="c"&gt;#      Populated by the system. Read-only. More info:&lt;/span&gt;
           &lt;span class="c"&gt;#      https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  this is very useful to understand the resource yaml file:
&lt;/h3&gt;







&lt;h2&gt;
  
  
  DRY-RUN=client/server/none
&lt;/h2&gt;

&lt;h2&gt;
  
  
  if we want to create a resource YAML template - we can use  : &lt;strong&gt;&lt;em&gt;dry-run=client&lt;/em&gt;&lt;/strong&gt; parameter and export (-o) as yaml file
&lt;/h2&gt;

&lt;p&gt;the -o means --(o)utput format and can be yaml or json or text&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create nginx pod&lt;/span&gt;
kubectl run nginx &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nginx &lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Never &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;80 &lt;span class="nt"&gt;--dry-run&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;client &lt;span class="nt"&gt;-o&lt;/span&gt;  json
&lt;span class="c"&gt;#kubectl create deployment nginx  --dry-run=client  --image=nginx --replicas=3 -o yaml&lt;/span&gt;
&lt;span class="c"&gt;# dry-run - will not execute the command &lt;/span&gt;
&lt;span class="c"&gt;# -o yaml - will output as yaml format&lt;/span&gt;
&lt;span class="c"&gt;# -o json - will output as json format&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JSON :
&lt;/h3&gt;




&lt;p&gt;&lt;code&gt;kubectl run nginx --image=nginx --restart=Never --port=80 --dry-run=client -o json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pod"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apiVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"metadata"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nginx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"creationTimestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"labels"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nginx"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"spec"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"containers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nginx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nginx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"ports"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="nl"&gt;"containerPort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"resources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"restartPolicy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Never"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dnsPolicy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ClusterFirst"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  it is very useful to add pipeline to a new file ( .. &amp;gt; &amp;lt; new-file &amp;gt; )  when using dry-run=client
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;example inline ...&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  YAML :
&lt;/h3&gt;




&lt;p&gt;&lt;code&gt;kubectl run nginx --image=nginx --restart=Never --port=80 --dry-run=client -o  yaml &amp;gt; run-nginx-template.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;creationTimestamp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;
  &lt;span class="na"&gt;dnsPolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterFirst&lt;/span&gt;
  &lt;span class="na"&gt;restartPolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Never&lt;/span&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;

&lt;span class="c1"&gt;# this way, the yaml will be saved inside the yaml file to be executed later. &lt;/span&gt;
&lt;span class="c1"&gt;# so we used to **dry-run** to create a yaml fiel for next deploy of this pod &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CHANGING PODS
&lt;/h2&gt;

&lt;p&gt;we can use 2 methods to change pod &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;### imperative
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   kubectl edit pod &amp;lt;pod-name&amp;gt;

    &lt;span class="c"&gt;# all of the pods YAML will be displayed in a vi editor and we can set values and save &lt;/span&gt;
    &lt;span class="c"&gt;# if the saved version has invalid fields ( syntax error )  the changes will not be commited&lt;/span&gt;
    &lt;span class="c"&gt;# and we cant exit from edit window (vi)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;### declerative 
edit the yaml file of the resource &lt;strong&gt;(POD)&lt;/strong&gt; with wanted values  and then execute :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; ./changed_nginx-pod.yaml 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DUPLICATING PODS YAML/JSON
&lt;/h2&gt;

&lt;p&gt;if we have a running pod - we can use &lt;strong&gt;imperative&lt;/strong&gt; command to duplicate it and magke changes at the side - in an editor for next use withapply : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;### duplicate the pod yaml file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  kubectl get pod  nginx-pod-1 &lt;span class="nt"&gt;-o&lt;/span&gt; yaml &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; duplicated_nginx-pod-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;### edit value of YAML pod
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/containerPort: 80/containerPort: 81/'&lt;/span&gt; duplicated_nginx-pod-1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;### uply new changes on pod :
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f ./duplicated_nginx-pod-1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  INSPECTING PODS - LOGS , DESCRIBE
&lt;/h2&gt;

&lt;p&gt;there are 2 ways to see PODS logs &lt;/p&gt;

&lt;h3&gt;
  
  
  1. DESCRIBE -
&lt;/h3&gt;

&lt;p&gt;desct=ribe actually used to probe any META DATA about a pod. &lt;/p&gt;

&lt;p&gt;it gives us documentation about thr node that the pod is in , the namespace and other infrastractural data &lt;/p&gt;

&lt;p&gt;but it also gives us details about last failing logs&lt;/p&gt;

&lt;p&gt;so this is very useful command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#kubectl describe pod &amp;lt; pod-name &amp;gt;&lt;/span&gt;
kubectl describe pod nginx-pod-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;describe show us full data about the pod, the namespace , the node etc ... &lt;/p&gt;

&lt;p&gt;more then this - we can see last logs of the pod &lt;br&gt;
it is very useful also when we have failover of pod - we ma inspect the last logs that are shown in the desribe output &lt;/p&gt;
&lt;h3&gt;
  
  
  2. LOGS
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# kubectl logs &amp;lt; pod-name &amp;gt;&lt;/span&gt;
kubectl logs nginx-pod-1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;#### TAIL LOGS : 
if we want to tail logs (like tail -f) we can use -f flag :
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; kubectl logs &lt;span class="nt"&gt;-f&lt;/span&gt; nginx-pod-1 

&lt;span class="c"&gt;# idubi@DESKTOP-82998RE  3.12  ~/.../Resources/Day07   Day07 ●  kubectl logs -f nginx-pod-1 &lt;/span&gt;
&lt;span class="nt"&gt;------------------------------------------------------------------------------------------------------&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh&lt;/span&gt;
&lt;span class="c"&gt;# 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf&lt;/span&gt;
&lt;span class="c"&gt;# 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh&lt;/span&gt;
&lt;span class="c"&gt;# /docker-entrypoint.sh: Configuration complete; ready for start up&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: using the "epoll" event method&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: nginx/1.28.0&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) &lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: OS: Linux 5.15.167.4-microsoft-standard-WSL2&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker processes&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker process 33&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker process 34&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker process 35&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker process 36&lt;/span&gt;
&lt;span class="c"&gt;# 2025/05/03 15:41:49 [notice] 1#1: start worker process 37 &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  PODS - INTERACTIVE MODE
&lt;/h2&gt;

&lt;p&gt;this is especially useful if we want to look at logs &lt;br&gt;
or probe executions inside the pods container&lt;br&gt;
just like in docker (i)nterac(t)ive  mode&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#kubectl exec -it &amp;lt; pod-name &amp;gt; -- &amp;lt;command&amp;gt;&lt;/span&gt;
kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; nginx-pod-1 &lt;span class="nt"&gt;--&lt;/span&gt; sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DELETE A POD
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# kubectl delete pod &amp;lt; pod-name &amp;gt;&lt;/span&gt;
kubectl delete pod nginx-pod-1

&lt;span class="c"&gt;# ✘ idubi@DESKTOP-82998RE  3.12  ~/.../Resources/Day07   Day07 ●  kubectl get pods &lt;/span&gt;
&lt;span class="c"&gt;# NAME          READY   STATUS    RESTARTS     AGE&lt;/span&gt;
&lt;span class="c"&gt;# 1st-nginx     1/1     Running   0            8h&lt;/span&gt;
&lt;span class="c"&gt;# nginx-pod-1   1/1     Running   2 (8h ago)   8h&lt;/span&gt;
&lt;span class="c"&gt;# idubi@DESKTOP-82998RE  3.12  ~/.../Resources/Day07   Day07 ●  kubectl delete pod 1st-nginx&lt;/span&gt;
&lt;span class="c"&gt;# pod "1st-nginx" deleted&lt;/span&gt;
&lt;span class="c"&gt;# idubi@DESKTOP-82998RE  3.12  ~/.../Resources/Day07   Day07 ●  kubectl get pods &lt;/span&gt;
&lt;span class="c"&gt;# NAME          READY   STATUS    RESTARTS     AGE&lt;/span&gt;
&lt;span class="c"&gt;# nginx-pod-1   1/1     Running   2 (8h ago)   8h&lt;/span&gt;
&lt;span class="c"&gt;# idubi@DESKTOP-82998RE  3.12  ~/.../Resources/Day07   Day07 ●  &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;












&lt;h1&gt;
  
  
  EXERCISE :
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Task 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a pod using the imperative command and use nginx as the image
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl run nginx &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nginx &lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Never &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Task2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the YAML from the nginx pod created in task 1
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; kubectl get pod nginx &lt;span class="nt"&gt;-o&lt;/span&gt; yaml &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; nginx-new.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Update the pod name in the YAML
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/name: nginx/name: nginx-new/'&lt;/span&gt; nginx-new.yaml
&lt;span class="nb"&gt;cat  &lt;/span&gt;nginx-new.yaml|grep &lt;span class="nt"&gt;-C&lt;/span&gt; 3 &lt;span class="s1"&gt;'name: nginx'&lt;/span&gt;
&lt;span class="c"&gt;#  vagrant@master-node:~/temp$ cat  nginx-new.yaml|grep -C 3 'name: nginx'&lt;/span&gt;
&lt;span class="c"&gt;#    creationTimestamp: "2025-05-04T00:22:22Z"&lt;/span&gt;
&lt;span class="c"&gt;#    labels:&lt;/span&gt;
&lt;span class="c"&gt;#      run: nginx&lt;/span&gt;
&lt;span class="c"&gt;#    name: nginx-new&lt;/span&gt;
&lt;span class="c"&gt;#    namespace: default&lt;/span&gt;
&lt;span class="c"&gt;#    resourceVersion: "249909"&lt;/span&gt;
&lt;span class="c"&gt;#    uid: 7b44db2b-0ca3-4813-9740-494d9287e7ad&lt;/span&gt;
&lt;span class="c"&gt;#  --&lt;/span&gt;
&lt;span class="c"&gt;#    containers:&lt;/span&gt;
&lt;span class="c"&gt;#    - image: nginx&lt;/span&gt;
&lt;span class="c"&gt;#      imagePullPolicy: Always&lt;/span&gt;
&lt;span class="c"&gt;#      name: nginx-new&lt;/span&gt;
&lt;span class="c"&gt;#      ports:&lt;/span&gt;
&lt;span class="c"&gt;#      - containerPort: 81&lt;/span&gt;
&lt;span class="c"&gt;#        protocol: TCP&lt;/span&gt;
&lt;span class="c"&gt;#  --&lt;/span&gt;
&lt;span class="c"&gt;#      image: docker.io/library/nginx:latest&lt;/span&gt;
&lt;span class="c"&gt;#      imageID: docker.io/library/#  nginx@sha256:c15da6c91de8d2f436196f3a768483ad32c258ed4e1beb3d367a27ed67253e66&lt;/span&gt;
&lt;span class="c"&gt;#      lastState: {}&lt;/span&gt;
&lt;span class="c"&gt;#      name: nginx-new&lt;/span&gt;
&lt;span class="c"&gt;#      ready: true&lt;/span&gt;
&lt;span class="c"&gt;#      restartCount: 0&lt;/span&gt;
&lt;span class="c"&gt;#      started: true&lt;/span&gt;
&lt;span class="c"&gt;#  &lt;/span&gt;

&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/containerPort: 80/containerPort: 81/'&lt;/span&gt; nginx-new.yaml
&lt;span class="nb"&gt;cat  &lt;/span&gt;nginx-new.yaml|grep &lt;span class="nt"&gt;-C&lt;/span&gt; 3 port
&lt;span class="c"&gt;#  vagrant@master-node:~/temp$ cat  nginx-new.yaml|grep -C 3 port&lt;/span&gt;
&lt;span class="c"&gt;#    - image: nginx&lt;/span&gt;
&lt;span class="c"&gt;#      imagePullPolicy: Always&lt;/span&gt;
&lt;span class="c"&gt;#      name: nginx&lt;/span&gt;
&lt;span class="c"&gt;#      ports:&lt;/span&gt;
&lt;span class="c"&gt;#      - containerPort: 81&lt;/span&gt;
&lt;span class="c"&gt;#        protocol: TCP&lt;/span&gt;
&lt;span class="c"&gt;#      resources: {}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use that YAML to create a new pod with the name nginx-new.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; ./nginx-new.yaml

&lt;span class="c"&gt;# vagrant@master-node:~/temp$ kubectl get pods&lt;/span&gt;
&lt;span class="c"&gt;# NAME    READY   STATUS    RESTARTS   AGE&lt;/span&gt;
&lt;span class="c"&gt;# nginx   1/1     Running   0          19m&lt;/span&gt;
&lt;span class="c"&gt;# vagrant@master-node:~/temp$ kubectl apply -f ./&lt;/span&gt;
&lt;span class="c"&gt;# duplicate-nginx-1.json  duplicate-nginx-1.yaml  nginx-new.yaml          nginx-pod-1.yaml&lt;/span&gt;
&lt;span class="c"&gt;# vagrant@master-node:~/temp$ kubectl apply -f ./nginx-new.yaml&lt;/span&gt;
&lt;span class="c"&gt;# pod/nginx-new created&lt;/span&gt;
&lt;span class="c"&gt;# vagrant@master-node:~/temp$ kubectl get pods&lt;/span&gt;
&lt;span class="c"&gt;# NAME        READY   STATUS    RESTARTS   AGE&lt;/span&gt;
&lt;span class="c"&gt;# nginx       1/1     Running   0          20m&lt;/span&gt;
&lt;span class="c"&gt;# nginx-new   1/1     Running   0          28s&lt;/span&gt;
&lt;span class="c"&gt;# &lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Task3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apply the below YAML and fix the errors, including all the commands that you run during the troubleshooting and the error message
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;test&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;redis&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rediss&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;redis&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"apiVersion: v1
kind: Pod
metadata:
  labels:
    app: test
  name: redis
spec:
  containers:
  - image: rediss
    name: redis"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; failed-redis.yaml 

kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; ./failed-redis.yaml



&lt;span class="o"&gt;![&lt;/span&gt;Image description]&lt;span class="o"&gt;(&lt;/span&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95ecud0130t9jwo422zg.png&lt;span class="o"&gt;)&lt;/span&gt;



kubectl get pods

&lt;span class="c"&gt;#  vagrant@master-node:~/temp$ kubectl get pdos&lt;/span&gt;
&lt;span class="c"&gt;#  error: the server doesn't have a resource type "pdos"&lt;/span&gt;
&lt;span class="c"&gt;#  vagrant@master-node:~/temp$ kubectl get pods&lt;/span&gt;
&lt;span class="c"&gt;#  NAME        READY   STATUS             RESTARTS   AGE&lt;/span&gt;
&lt;span class="c"&gt;#  nginx       1/1     Running            0          24m&lt;/span&gt;
&lt;span class="c"&gt;#  nginx-new   1/1     Running            0          4m33s&lt;/span&gt;
&lt;span class="c"&gt;#  redis       0/1     ImagePullBackOff   0          85s&lt;/span&gt;

kubectl logs redis 

&lt;span class="c"&gt;#vagrant@master-node:~/temp$ kubctl logs redis&lt;/span&gt;
&lt;span class="c"&gt;#-bash: kubctl: command not found&lt;/span&gt;
&lt;span class="c"&gt;#vagrant@master-node:~/temp$ kubectl logs redis&lt;/span&gt;
&lt;span class="c"&gt;#Error from server (BadRequest): container "redis" in pod "redis" is #waiting to start: trying and failing to pull image&lt;/span&gt;

kubectl describe pod redis


&lt;span class="o"&gt;![&lt;/span&gt;Image description]&lt;span class="o"&gt;(&lt;/span&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vwd3dtn85g1ni4wjdx5.png&lt;span class="o"&gt;)&lt;/span&gt;




&lt;span class="c"&gt;#  vagrant@master-node:~/temp$ kubectl describe pod redis&lt;/span&gt;
&lt;span class="c"&gt;#  Name:             redis&lt;/span&gt;
&lt;span class="c"&gt;#  Namespace:        default&lt;/span&gt;
&lt;span class="c"&gt;#  Priority:         0&lt;/span&gt;
&lt;span class="c"&gt;#  Service Account:  default&lt;/span&gt;
&lt;span class="c"&gt;#  Node:             worker-node-1/192.168.133.167&lt;/span&gt;
&lt;span class="c"&gt;#  Start Time:       Sun, 04 May 2025 00:45:05 +0000&lt;/span&gt;
&lt;span class="c"&gt;#  Labels:           app=test&lt;/span&gt;
...
              &lt;span class="nt"&gt;----&lt;/span&gt;               &lt;span class="nt"&gt;-------&lt;/span&gt;
              &lt;span class="nt"&gt;----&lt;/span&gt;               &lt;span class="nt"&gt;-------&lt;/span&gt;
              &lt;span class="nt"&gt;----&lt;/span&gt;               &lt;span class="nt"&gt;-------&lt;/span&gt;
...
&lt;span class="c"&gt;#    Normal   Scheduled  2m21s                default-scheduler  Successfully assigned default/redis to #  worker-node-1&lt;/span&gt;
&lt;span class="c"&gt;#    Normal   Pulling    59s (x4 over 2m21s)  kubelet            Pulling image "rediss"&lt;/span&gt;
&lt;span class="c"&gt;#    Warning  Failed     57s (x4 over 2m19s)  kubelet            Failed to pull image "rediss": failed to pull #  and unpack image "docker.io/library/rediss:latest": failed to resolve reference "docker.io/library/#  rediss:latest": pull access denied, repository does not exist or may require authorization: server message: #  insufficient_scope: authorization failed&lt;/span&gt;
&lt;span class="c"&gt;#    Warning  Failed     57s (x4 over 2m19s)  kubelet            Error: ErrImagePull&lt;/span&gt;
&lt;span class="c"&gt;#    Normal   BackOff    3s (x8 over 2m19s)   kubelet            Back-off pulling image "rediss"&lt;/span&gt;
&lt;span class="c"&gt;#    Warning  Failed     3s (x8 over 2m19s)   kubelet            Error: ImagePullBackOff&lt;/span&gt;
&lt;span class="c"&gt;#  &lt;/span&gt;

kubectl edit pod redis 

&lt;span class="c"&gt;# change rediss --&amp;gt; redis   # --&amp;gt;  CTRL+x&lt;/span&gt;

kubectl get pod redis

&lt;span class="c"&gt;#   vagrant@master-node:~/temp$ kubectl get pod redis&lt;/span&gt;
&lt;span class="c"&gt;#   NAME    READY   STATUS    RESTARTS   AGE&lt;/span&gt;
&lt;span class="c"&gt;#   redis   1/1     Running   0          15m&lt;/span&gt;


&lt;span class="o"&gt;![&lt;/span&gt;Image description]&lt;span class="o"&gt;(&lt;/span&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hqaowcbof5cm9cptqrvp.png&lt;span class="o"&gt;)&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>40daysofkubernetes</category>
      <category>kubernetes</category>
      <category>idobistry</category>
      <category>k8s</category>
    </item>
    <item>
      <title>create your own k8s - Multi nodes - KUBEADM &amp; DIND platform</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Sat, 03 May 2025 02:10:34 +0000</pubDate>
      <link>https://dev.to/idubi/create-your-own-k8s-multi-nodes-kubeadm-dind-platform-1116</link>
      <guid>https://dev.to/idubi/create-your-own-k8s-multi-nodes-kubeadm-dind-platform-1116</guid>
      <description>&lt;h1&gt;
  
  
  Create Your Own K8s Multi-Node Platform – KUBEADM &amp;amp; DIND
&lt;/h1&gt;

&lt;h2&gt;
  
  
  40 Days of K8s – CKA Challenge (06/40)
&lt;/h2&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=RORhczcOrWs" rel="noopener noreferrer"&gt;Day 6/40 - Kubernetes Multi Node Cluster Setup Step By Step | Kind Tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  In this post, I demonstrate two architectures I used to create a functioning multi-node Kubernetes environment.
&lt;/h3&gt;




&lt;p&gt;This environment serves as a sandbox for upcoming lessons.&lt;/p&gt;

&lt;h3&gt;
  
  
  The two environments are based on different architectures:
&lt;/h3&gt;




&lt;h4&gt;
  
  
  1. Containerized architecture – using the KIND Kubernetes provider over Docker
&lt;/h4&gt;

&lt;h4&gt;
  
  
  2. VM-based architecture – using a fully functioning KUBEADM setup
&lt;/h4&gt;




&lt;h3&gt;
  
  
  1. KIND: Containerized Architecture (KIND over Docker)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Prerequisites:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Golang &amp;gt; 1.6&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;golang-go
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker (already installed)  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kubectl&lt;/code&gt; – Kubernetes CLI&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Download the latest version&lt;/span&gt;
curl &lt;span class="nt"&gt;-LO&lt;/span&gt; &lt;span class="s2"&gt;"https://dl.k8s.io/release/&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; https://dl.k8s.io/release/stable.txt&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;/bin/linux/amd64/kubectl.sha256"&lt;/span&gt;

&lt;span class="c"&gt;# 2. Install kubectl&lt;/span&gt;
&lt;span class="nb"&gt;sudo install&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; root &lt;span class="nt"&gt;-g&lt;/span&gt; root &lt;span class="nt"&gt;-m&lt;/span&gt; 0755 kubectl /usr/local/bin/kubectl

&lt;span class="c"&gt;# 3. Test the installation&lt;/span&gt;
kubectl version &lt;span class="nt"&gt;--client&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;KIND:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For AMD64 / x86_64&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; x86_64 &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class="nt"&gt;-Lo&lt;/span&gt; ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64

&lt;span class="c"&gt;# For ARM64&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; aarch64 &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class="nt"&gt;-Lo&lt;/span&gt; ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-arm64

&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ./kind
&lt;span class="nb"&gt;sudo mv&lt;/span&gt; ./kind /usr/local/bin/kind
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Create a Cluster:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can create a cluster either by running a single-node setup:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kind create cluster &lt;span class="nt"&gt;--image&lt;/span&gt; kindest/node:v1.32.2@sha256:f226345927d7e348497136874b6d207e0b32cc52154ad8323129352923a3142f &lt;span class="nt"&gt;--name&lt;/span&gt; cka-cluster-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Or by preparing a YAML configuration for a multi-node setup:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create a YAML file describing the cluster:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Cluster&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kind.x-k8s.io/v1alpha4&lt;/span&gt;
&lt;span class="na"&gt;nodes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;control-plane&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;control-plane&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;worker&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;worker&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;worker&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;worker&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;2. Create the cluster using the YAML file:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kind create cluster       &lt;span class="nt"&gt;--image&lt;/span&gt; kindest/node:v1.32.2@sha256:f226345927d7e348497136874b6d207e0b32cc52154ad8323129352923a3142f       &lt;span class="nt"&gt;--name&lt;/span&gt; cka-cluster-2       &lt;span class="nt"&gt;--config&lt;/span&gt; kind-2master-4workers
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Verify the Created Cluster:
&lt;/h4&gt;

&lt;p&gt;After creating the cluster, validate its configuration using the &lt;code&gt;kubectl&lt;/code&gt; CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl config get-clusters
kubectl config get-users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Docker View of KIND Nodes:
&lt;/h4&gt;

&lt;p&gt;Since KIND uses Docker under the hood, each Kubernetes node is represented as a Docker container. Switching context via &lt;code&gt;kubectl config use-context &amp;lt;cluster-name&amp;gt;&lt;/code&gt; will show the corresponding containers becoming active:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Example output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONTAINER ID   IMAGE                    ...        NAMES
16462509a712   kindest/haproxy:...     ...        cka-cluster-2-external-load-balancer
4016000812c4   kindest/node:...        ...        cka-cluster-2-control-plane2
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Common Commands:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl config current-context
kubectl get nodes

kubectl config use-context kind-cka-cluster-1
kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. VM-Based Architecture – KUBEADM Kubernetes Using VAGRANT
&lt;/h3&gt;

&lt;h4&gt;
  
  
  The VM architecture differs from Docker:
&lt;/h4&gt;

&lt;p&gt;Each VM is a full OS instance acting as a node (master or worker).&lt;br&gt;&lt;br&gt;
The general flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Kubeadm on the main master node and run &lt;code&gt;kubeadm init&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create a token to allow other nodes to join.&lt;/li&gt;
&lt;li&gt;Other nodes (including additional masters) join using this token.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I used &lt;strong&gt;Vagrant&lt;/strong&gt; to automate both VM creation and the Kubeadm setup process.&lt;/p&gt;


&lt;h4&gt;
  
  
  1. VM Setup
&lt;/h4&gt;

&lt;p&gt;You need a VM platform like &lt;strong&gt;VirtualBox&lt;/strong&gt;, &lt;strong&gt;VMware&lt;/strong&gt;, or &lt;strong&gt;Hyper-V&lt;/strong&gt; that supports Vagrant.&lt;/p&gt;
&lt;h4&gt;
  
  
  Folder structure:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;k8s-vmware-cluster/
├── Vagrantfile
├── common.sh
├── master.sh
├── worker.sh
└── disable-swap.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Vagrant Installation
&lt;/h4&gt;

&lt;p&gt;Ensure you're running on a system with a hypervisor (macOS, Windows, Linux).&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Do not run Vagrant-based VMs on WSL.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install Vagrant:&lt;br&gt;&lt;br&gt;
Follow &lt;a href="https://developer.hashicorp.com/vagrant/docs/installation" rel="noopener noreferrer"&gt;Vagrant installation instructions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For VMware users:&lt;br&gt;&lt;br&gt;
Install the &lt;a href="https://github.com/hashicorp/vagrant-vmware-desktop" rel="noopener noreferrer"&gt;vagrant-vmware-desktop plugin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  3. Vagrantfile – VM Orchestration
&lt;/h4&gt;

&lt;p&gt;Each VM is provisioned with common resources and then initialized using shell scripts.&lt;/p&gt;
&lt;h4&gt;
  
  
  Master Node:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt; &lt;span class="s2"&gt;"master-node"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hostname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"master-node"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt; &lt;span class="s2"&gt;"private_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;ip: &lt;/span&gt;&lt;span class="s2"&gt;"192.168.56.10"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"common.sh"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"master.sh"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"disable-swap.sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;run: &lt;/span&gt;&lt;span class="s2"&gt;"always"&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In &lt;code&gt;master.sh&lt;/code&gt;, the following happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs &lt;code&gt;kubeadm init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generates the &lt;code&gt;join.sh&lt;/code&gt; script containing the token&lt;/li&gt;
&lt;li&gt;Other nodes will use this script to join the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  Worker Node:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt; &lt;span class="s2"&gt;"worker-node-1"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hostname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"worker-node-1"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt; &lt;span class="s2"&gt;"private_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;ip: &lt;/span&gt;&lt;span class="s2"&gt;"192.168.56.11"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"common.sh"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"worker.sh"&lt;/span&gt;
  &lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"disable-swap.sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;run: &lt;/span&gt;&lt;span class="s2"&gt;"always"&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;The worker script waits for &lt;code&gt;join.sh&lt;/code&gt; to be generated by the master and then executes it.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Wait for join.sh&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;1..30&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /vagrant/join.sh &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;break
  &lt;/span&gt;&lt;span class="k"&gt;fi
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"[&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="s1"&gt;'+%T'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;] Waiting for /vagrant/join.sh... (try &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;/30)"&lt;/span&gt;
  &lt;span class="nb"&gt;sleep &lt;/span&gt;10
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"30"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Timeout waiting for /vagrant/join.sh"&lt;/span&gt;
    &lt;span class="nb"&gt;exit &lt;/span&gt;1
  &lt;span class="k"&gt;fi
done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  SWAP Management:
&lt;/h4&gt;

&lt;p&gt;Kubernetes requires swap to be disabled.&lt;br&gt;&lt;br&gt;
Even though &lt;code&gt;common.sh&lt;/code&gt; disables swap on boot, VM restarts may re-enable it.&lt;/p&gt;
&lt;h4&gt;
  
  
  Ensure swap is disabled &lt;strong&gt;always&lt;/strong&gt;:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;node_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"disable-swap.sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;run: &lt;/span&gt;&lt;span class="s2"&gt;"always"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Both KIND and KUBEADM architectures achieve the same goal with different approaches:
&lt;/h3&gt;
&lt;h4&gt;
  
  
  KIND:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Simple and fast&lt;/li&gt;
&lt;li&gt;Uses Docker containers&lt;/li&gt;
&lt;li&gt;Best for development or sandbox use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vyjy3k98nygtrvglcms.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vyjy3k98nygtrvglcms.png" alt="Image description" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  KUBEADM on VMs:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Production-grade realism&lt;/li&gt;
&lt;li&gt;Full control over networking, bootstrapping, and configuration&lt;/li&gt;
&lt;li&gt;Greater complexity and overhead&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbc9xqug0jfq2m6ozh1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbc9xqug0jfq2m6ozh1k.png" alt="Image description" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Both setups follow a similar underlying flow:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;crations of master node 

&lt;ul&gt;
&lt;li&gt; + container-D&lt;/li&gt;
&lt;li&gt; + contrl plan components &lt;/li&gt;
&lt;li&gt; + kubeadm &amp;amp; kubeproxy (since the control plan components are executed inside pods after all ...)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;creation of worker nodes 

&lt;ul&gt;
&lt;li&gt; + container-D&lt;/li&gt;
&lt;li&gt; + kubeproxy + kubeadm (since this are the worker node processes )&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;join the workers to the master by using kubeadm join (with the master token generated at master process)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhndz9kh749l4sx51drpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhndz9kh749l4sx51drpu.png" alt="Image description" width="800" height="765"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  SOME KIND EXECUTIONS :
&lt;/h2&gt;

&lt;p&gt;kubectl get nodes &lt;/p&gt;

&lt;p&gt;kubectl config get-clusters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ✘ idubi@DESKTOP-82998RE  3.12  ~/.../40DAysOfK8-CKA/Resources   Day06 ●  kubectl config get-clusters
NAME
kind-cka-cluster-1
kind-cka-cluster-2
docker-desktop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config get-contexts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ✘ idubi@DESKTOP-82998RE  3.12  ~/.../40DAysOfK8-CKA/Resources   Day06 ●  kubectl config get-contexts
CURRENT   NAME                 CLUSTER              AUTHINFO             NAMESPACE
          docker-desktop       docker-desktop       docker-desktop       
          kind-cka-cluster-1   kind-cka-cluster-1   kind-cka-cluster-1   
*         kind-cka-cluster-2   kind-cka-cluster-2   kind-cka-cluster-2   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config use-context kind-cka-cluster-1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Switched to context "kind-cka-cluster-1".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config get-contexts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CURRENT   NAME                 CLUSTER              AUTHINFO             NAMESPACE
          docker-desktop       docker-desktop       docker-desktop       
*         kind-cka-cluster-1   kind-cka-cluster-1   kind-cka-cluster-1   
          kind-cka-cluster-2   kind-cka-cluster-2   kind-cka-cluster-2   
 idubi@DESKTOP-82998RE  3.12  ~/.../40DAysOfK8-CKA/Resources   Day06 ●  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kind delete cluster --name cka-cluster-2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deleting cluster "cka-cluster-2" ...
Deleted nodes: ["cka-cluster-2-control-plane2" "cka-cluster-2-worker2" "cka-cluster-2-control-plane" "cka-cluster-2-external-load-balancer" "cka-cluster-2-worker4" "cka-cluster-2-worker" "cka-cluster-2-worker3"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kind get clusters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cka-cluster-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config get-clusters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NAME
docker-desktop
kind-cka-cluster-1`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kind create cluster --image kindest/node:v1.32.2@sha256:f226345927d7e348497136874b6d207e0b32cc52154ad8323129352923a3142f --name cka-cluster-2  --config kind-2master-4workers.yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Creating cluster "cka-cluster-2" ...
 ✓ Ensuring node image (kindest/node:v1.32.2) 🖼
 ✓ Preparing nodes 📦 📦 📦 📦 📦 📦  
 ✓ Configuring the external load balancer ⚖️ 
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Joining more control-plane nodes 🎮 
 ✓ Joining worker nodes 🚜 
Set kubectl context to "kind-cka-cluster-2"
You can now use your cluster with:

kubectl cluster-info --context kind-cka-cluster-2

Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl cluster-info --context kind-cka-cluster-2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Kubernetes control plane is running at https://127.0.0.1:42379
CoreDNS is running at https://127.0.0.1:42379/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl get nodes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NAME                           STATUS   ROLES           AGE     VERSION
cka-cluster-2-control-plane    Ready    control-plane   4m40s   v1.32.2
cka-cluster-2-control-plane2   Ready    control-plane   4m34s   v1.32.2
cka-cluster-2-worker           Ready    &amp;lt;none&amp;gt;          4m27s   v1.32.2
cka-cluster-2-worker2          Ready    &amp;lt;none&amp;gt;          4m27s   v1.32.2
cka-cluster-2-worker3          Ready    &amp;lt;none&amp;gt;          4m27s   v1.32.2
cka-cluster-2-worker4          Ready    &amp;lt;none&amp;gt;          4m27s   v1.32.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config get-contexts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CURRENT   NAME                 CLUSTER              AUTHINFO             NAMESPACE
          docker-desktop       docker-desktop       docker-desktop       
          kind-cka-cluster-1   kind-cka-cluster-1   kind-cka-cluster-1   
*         kind-cka-cluster-2   kind-cka-cluster-2   kind-cka-cluster-2   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kubectl config get-clusters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NAME
kind-cka-cluster-2
docker-desktop
kind-cka-cluster-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kubernetes</category>
      <category>vagrant</category>
      <category>idobistry</category>
      <category>40daysofkubernetes</category>
    </item>
    <item>
      <title>What is Kubernetes - Kubernetes Architecture Explained</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Sat, 26 Apr 2025 14:14:00 +0000</pubDate>
      <link>https://dev.to/idubi/what-is-kubernetes-kubernetes-architecture-explained-4b95</link>
      <guid>https://dev.to/idubi/what-is-kubernetes-kubernetes-architecture-explained-4b95</guid>
      <description>&lt;h2&gt;
  
  
  40 days of K8s - CKA challenge (05/40)
&lt;/h2&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=SGGkUCctL4I" rel="noopener noreferrer"&gt;Day 5/40 - What is Kubernetes - Kubernetes Architecture Explained&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;this post summerise the Architecture of K8s and its main processes&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27lnswg4dkxo3ot22tqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27lnswg4dkxo3ot22tqm.png" alt="Image description" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  the Architecture of K8s and its main processes
&lt;/h2&gt;

&lt;p&gt;a K8s cluster contains 2 types of nodes: &lt;/p&gt;

&lt;h2&gt;
  
  
  Master NODE (control plane)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ETCD &lt;/li&gt;
&lt;li&gt;API SERVER&lt;/li&gt;
&lt;li&gt;SCHEDULER &lt;/li&gt;
&lt;li&gt;CONTROLLER MANAGER&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Worker NODE
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;KUBELETS&lt;/li&gt;
&lt;li&gt;KUBE PROXY&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1.  MASTER NODE - control plane
&lt;/h2&gt;

&lt;p&gt;the master node consists 3 main processes and ETCD Component.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ETCD&lt;/strong&gt; - &lt;em&gt;(Extended Tree Configuration Database)&lt;/em&gt; this is a &lt;strong&gt;key:value _(like JSON objects)&lt;/strong&gt;_ database that represent the metadata of the clkuster. &lt;br&gt;
it includes all of the structural entities statuses in a given time. &lt;br&gt;
whenever a change is needed, of a new entity or current one configuration - this chagnge is updated to the ETCD and upon the new value and current value - the new entity will be created/updated. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SCHEDULER&lt;/strong&gt; -  SCHEDULER is in charge of 1 specific thing : schedule the creation of a new POD into a specific NODE.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Scheduler only acts on unscheduled Pods&lt;/em&gt;&lt;/strong&gt; :  Pods with spec.nodeName not set.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    The only times that happens 
    ---------------------------------------------------------
    o   A new Pod is created
    o   Directly (kubectl run)
    o   Indirectly via a controller (Deployment, Job, ReplicaSet)
    o   An existing Pod is deleted and the controller creates a replacement
    o   A Pod gets rescheduled (after Node failure, eviction, etc.)


        When the scheduler is not involved
    ---------------------------------------------------------
    o   If you run any command that doesn't result in a new Pod, the scheduler does nothing.


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;API SERVER - is the main component of the Kubernetes cluster - after the ETCD
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what is API SERVER in charge of :
---------------------------------
o   validate any call from CLI or rest call 
o   store the request in ETCD
o   acts as a client to control manager or scheduler to read from ETCD 
o   send a message to the specific NODE's kubelete and trigger it,
    when any changes need to be done inside it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if any of the &lt;em&gt;ETCD&lt;/em&gt; or  &lt;em&gt;API Server&lt;/em&gt; is failing, they must be recovered. &lt;br&gt;
but as long they are down - current nodes function autonomly, but any change in the cluster is impossible. &lt;br&gt;
the kubeletes (will speak about it soon) will keet the current status in the node, but any change in replicaset or pods or any other status of the cluster cant be done. &lt;/p&gt;

&lt;p&gt;if the APIServer is failing - there is no connection between te components of the cluster, and command cant be setnt to the K8s cluster from outside of the cluster (no cli or api commmands)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CONTROLLER MANAGER - monitor all ofthe controllers inside the cluster. 
the control is done throught the ETCD.  it is useing the API sServer to read from the rtcd - the cesesary data about the different components in the cluster nodes.
it runs several &lt;strong&gt;control loops&lt;/strong&gt;, each loop is a controller, responsible for managing a specific Kubernetes &lt;strong&gt;&lt;em&gt;resource type&lt;/em&gt;&lt;/strong&gt;
how does it monitor ? by watching the ETCD via the &lt;strong&gt;&lt;em&gt;API SEVER&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;#### Just like the scheduler, the controller manager watches for changes to objects it's responsible for, via the use of &lt;strong&gt;API SERVER&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;## example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Example:
    If you create a Deployment, the Deployment controller:
    -------------------------------------------------------
    o   Watches for Deployments via the API server.
    o   Sees that it needs 3 replicas.
    o   Creates 3 ReplicaSets via the API server.
    o   ReplicaSet controller sees that, and creates 3 Pods.
    o   All of this flows through the API server.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The control loop pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Watch: Observe resources via the API server.&lt;/li&gt;
&lt;li&gt; Compare: Desired state vs current state.&lt;/li&gt;
&lt;li&gt; Act: If there's a diff, make changes via the API server.&lt;/li&gt;
&lt;li&gt; API server updates etcd.
________________________________________&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  here is a list of controllers (loops) inside the conttroller manager:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Controller Name&lt;/th&gt;
&lt;th&gt;What it Manages&lt;/th&gt;
&lt;th&gt;Example Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Node Controller&lt;/td&gt;
&lt;td&gt;Node health/status&lt;/td&gt;
&lt;td&gt;Marks Nodes as NotReady if kubelet is unresponsive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replication Controller&lt;/td&gt;
&lt;td&gt;ReplicationController resources&lt;/td&gt;
&lt;td&gt;Ensures the desired number of old-style RCs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReplicaSet Controller&lt;/td&gt;
&lt;td&gt;ReplicaSet resources&lt;/td&gt;
&lt;td&gt;Maintains correct number of Pods&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deployment Controller&lt;/td&gt;
&lt;td&gt;Deployment resources&lt;/td&gt;
&lt;td&gt;Handles rolling updates, rollback&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;StatefulSet Controller&lt;/td&gt;
&lt;td&gt;StatefulSet resources&lt;/td&gt;
&lt;td&gt;Ensures ordered, unique Pod identities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DaemonSet Controller&lt;/td&gt;
&lt;td&gt;DaemonSet resources&lt;/td&gt;
&lt;td&gt;Makes sure one Pod per Node is running&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Job Controller&lt;/td&gt;
&lt;td&gt;Job resources&lt;/td&gt;
&lt;td&gt;Manages Pods for short-lived jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CronJob Controller&lt;/td&gt;
&lt;td&gt;CronJob resources&lt;/td&gt;
&lt;td&gt;Creates Jobs based on a schedule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service Controller&lt;/td&gt;
&lt;td&gt;Service resources&lt;/td&gt;
&lt;td&gt;Updates iptables/IPVS rules, interacts with cloud LB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EndpointSlice Controller&lt;/td&gt;
&lt;td&gt;EndpointSlices&lt;/td&gt;
&lt;td&gt;Replaces legacy Endpoints, more scalable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Namespace Controller&lt;/td&gt;
&lt;td&gt;Namespace lifecycle&lt;/td&gt;
&lt;td&gt;Cleans up resources when namespace is deleted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PersistentVolume (PV) Controller&lt;/td&gt;
&lt;td&gt;PersistentVolume binding&lt;/td&gt;
&lt;td&gt;Matches PVCs to available PVs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PersistentVolumeClaim (PVC) Controller&lt;/td&gt;
&lt;td&gt;PVC lifecycle&lt;/td&gt;
&lt;td&gt;Manages volume provisioning and binding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ResourceQuota Controller&lt;/td&gt;
&lt;td&gt;ResourceQuota enforcement&lt;/td&gt;
&lt;td&gt;Blocks creation if limits exceeded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ServiceAccount Controller&lt;/td&gt;
&lt;td&gt;Default service accounts&lt;/td&gt;
&lt;td&gt;Automatically creates default ServiceAccounts in namespaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Token Controller&lt;/td&gt;
&lt;td&gt;Generates secrets for service accounts&lt;/td&gt;
&lt;td&gt;Token rotation and creation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CertificateSigningRequest Controller&lt;/td&gt;
&lt;td&gt;CSR approval and tracking&lt;/td&gt;
&lt;td&gt;Used in TLS bootstrap and cert renewal&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Cloud-specific Controllers (when running in a cloud environment)These run only if you’ve configured a cloud provider like AWS, GCP, or Azure:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Controller Name&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CloudNode Controller&lt;/td&gt;
&lt;td&gt;Syncs Node metadata with cloud provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudRoute Controller&lt;/td&gt;
&lt;td&gt;Manages routing tables (for overlay networks)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service LoadBalancer Controller&lt;/td&gt;
&lt;td&gt;Provisions cloud load balancers for type: LoadBalancer services&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  2.  Worker NODE
&lt;/h2&gt;

&lt;h3&gt;
  
  
  this are the worker nodes components and they run on any node
&lt;/h3&gt;

&lt;p&gt;KUBELET - Running and maintaining application Pods&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; kubelets are in charge of maintainence of the NODE. &lt;/li&gt;
&lt;li&gt;  talks to the container runtime (containerd / docker ) to ensure pods are erunning properly&lt;/li&gt;
&lt;li&gt;  talks to the ETCD via the API server to check new tasks/chagnges on the pod&lt;/li&gt;
&lt;li&gt;   it is critical for rnning and maintainnt the pods inside the node&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;KUBE-PROXY - Enabling Service discovery and internal communication&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  manages the network traffic rules on the node &lt;/li&gt;
&lt;li&gt;  Configures network routing rules so Services can work&lt;/li&gt;
&lt;li&gt;  talks to API Server (to learn about Services and Endpoints)
and Local iptables / IPVS system&lt;/li&gt;
&lt;li&gt;  Set up iptables or IPVS rules, and Load balance traffic inside the cluster&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxklfuqccri8gt9yx4sr1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxklfuqccri8gt9yx4sr1.png" alt="Image description" width="698" height="605"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>40daysofkubernetes</category>
      <category>idobistry</category>
    </item>
    <item>
      <title>Why Kubernetes Is Used - Kubernetes Simply Explained</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Fri, 25 Apr 2025 20:00:54 +0000</pubDate>
      <link>https://dev.to/idubi/why-kubernetes-is-used-kubernetes-simply-explained-2gbb</link>
      <guid>https://dev.to/idubi/why-kubernetes-is-used-kubernetes-simply-explained-2gbb</guid>
      <description>&lt;h2&gt;
  
  
  40 days of K8s - CKA challenge (04/40)
&lt;/h2&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=ajetvJmBvFo&amp;amp;ab_channel=TechTutorialswithPiyush" rel="noopener noreferrer"&gt;Day 4/40 - Why Kubernetes Is Used - Kubernetes Simply Explained - CKA Full Course 2025&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;this post summerise what is an orchestrator and why Kubernetes (&lt;strong&gt;K8s&lt;/strong&gt;)  &lt;/p&gt;




&lt;h2&gt;
  
  
  what is an Orchestrator , why do we need k8s to
&lt;/h2&gt;

&lt;p&gt;after we learnt about Dcoker - we understand that we can create a containerized environment to work as production, as well as testing. &lt;/p&gt;

&lt;p&gt;this system can be scaled and maintained automatically - if we just had an orchestraiting system to manage it. &lt;/p&gt;

&lt;p&gt;a &lt;strong&gt;container orchestrator&lt;/strong&gt; is a system that automates the deployment, scaling, networking, and management of containerized applications. &lt;/p&gt;

&lt;p&gt;It plays a crucial role in production environments where services must remain available, resilient, and easily updatable.&lt;/p&gt;

&lt;p&gt;Without an orchestrator, managing hundreds or thousands of containers manually would be error-prone, inefficient, and unsustainable — especially in environments that demand high availability, dynamic scaling, and automated recovery from failure.&lt;/p&gt;

&lt;p&gt;Orchestration solves key challenges like &lt;strong&gt;service discovery, load balancing, health checks, resource scheduling, automated rollouts and rollbacks, and self-healing of applications&lt;/strong&gt; . &lt;/p&gt;

&lt;p&gt;It also provides &lt;strong&gt;centralized control&lt;/strong&gt; over &lt;strong&gt;distributed infrastructure&lt;/strong&gt;,&lt;/p&gt;

&lt;p&gt;enabling teams to enforce &lt;strong&gt;consistency, optimize resource usage&lt;/strong&gt;, and &lt;strong&gt;respond to real-time changes&lt;/strong&gt; in application demand or infrastructure state.&lt;/p&gt;

&lt;p&gt;Kubernetes (K8s) has emerged as the most popular and powerful orchestrator, designed to manage complex, distributed systems at scale. Its key features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Declarative configuration&lt;/strong&gt;: Define desired system state using YAML/JSON, letting K8s reconcile reality with the declared spec.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Self-healing&lt;/strong&gt;: Automatically restarts failed containers, replaces unresponsive Pods, and evicts unhealthy nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Horizontal scaling&lt;/strong&gt;: Adjusts the number of running Pods based on CPU/memory usage or custom metrics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rolling updates and rollbacks&lt;/strong&gt;: Enables zero-downtime deployments with built-in version control and safe rollback in case of failure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Persistent volume management&lt;/strong&gt;: Abstracts storage resources and dynamically provisions volumes for stateful workloads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Service discovery and DNS&lt;/strong&gt;: Exposes services with internal or &lt;br&gt;
external networking via stable DNS names and load balancing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensibility&lt;/strong&gt;: Operators, CRDs, and webhooks make K8s highly customizable and adaptable to any workload or platform need.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From a DevOps and reliability engineering perspective, Kubernetes provides the automation, observability, and operational control needed to confidently run applications in production - reducing human error, accelerating delivery, and improving system resilience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj4kxe0tfros1fn1wmmc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj4kxe0tfros1fn1wmmc.png" alt="Image description" width="537" height="806"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>40daysofkubernetes</category>
      <category>kubernetes</category>
      <category>idobistry</category>
    </item>
    <item>
      <title>Multi Stage Docker Build - smaller is better</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Sun, 20 Apr 2025 23:32:11 +0000</pubDate>
      <link>https://dev.to/idubi/40-days-of-k8s-cka-challenge-0340-a8k</link>
      <guid>https://dev.to/idubi/40-days-of-k8s-cka-challenge-0340-a8k</guid>
      <description>&lt;h1&gt;
  
  
  40 days of K8s - CKA challenge (03/40)
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Multi Stage Docker Build - smaller is better
&lt;/h1&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=ajetvJmBvFo&amp;amp;ab_channel=TechTutorialswithPiyush" rel="noopener noreferrer"&gt;Day 3/40 - Multi Stage Docker Build - Docker Tutorial For Beginners - CKA Full Course 2024&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in the preview lesson - I created a docker image that is 1.2 GB &lt;/p&gt;

&lt;p&gt;this lesson discussed how to make an image smaller. &lt;br&gt;
the chapter focus on main methodology. &lt;br&gt;
let me here count some methods considered best approch &lt;br&gt;
(BEST PRACTICES) to create as small image as can be created. &lt;/p&gt;

&lt;p&gt;but 1ST : lets count main reasons : why &lt;em&gt;LARGE&lt;/em&gt; images are &lt;br&gt;
&lt;strong&gt;not&lt;/strong&gt; recommended:&lt;/p&gt;
&lt;h2&gt;
  
  
  there are several reasons why we want to make images smaller :
&lt;/h2&gt;

&lt;p&gt;(1) Faster Deployment&lt;/p&gt;

&lt;p&gt;
 * Smaller images pull and push faster
 * Reduced network bandwidth usage
 * Quicker container startup times
&lt;/p&gt;

&lt;p&gt;(2) Security Benefits&lt;/p&gt;

&lt;p&gt;
 * Smaller attack surface
 * Fewer potentially vulnerable packages
 * Less code to scan and maintain
&lt;/p&gt;

&lt;p&gt;(3) Resource Efficiency&lt;/p&gt;

&lt;p&gt;
 * Less disk space usage in registries
 * Reduced memory footprint
 * Better cache utilization
&lt;/p&gt;

&lt;p&gt;(4) Cost Savings&lt;/p&gt;

&lt;p&gt;
 * Lower storage costs in container registries
 * Reduced data transfer costs
 * More efficient use of cloud resources
&lt;/p&gt;

&lt;p&gt;(5) Better CI/CD Performance&lt;/p&gt;

&lt;p&gt;
 * Faster build pipelines
 * Quicker rollbacks if needed
 * Improved deployment reliability
&lt;/p&gt;

&lt;p&gt;there are several methods to make the docker image smaller, and the most recommended is using &lt;strong&gt;MULTISTAGE BUILD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;lets count and explain the methods : &lt;/p&gt;

&lt;h2&gt;
  
  
  Key techniques for slimming Docker images:
&lt;/h2&gt;

&lt;p&gt;(1) Start from a Minimal Base Image  ('-alpine' or '-slim' )&lt;/p&gt;

&lt;p&gt; when choosing the base image of a known application - usualy alpine
is available. when you create an image from scratch - use alpine as base
image.
alpine is a slim linux operation system, s owhen an image is created out
of alpine, it is usualy considering installing only what necesarry for
the application to use.&lt;/p&gt;
&lt;p&gt;there is also scratch image, which is an image that uses the HOST 
operating system as base, but it is not recommended- since we can never 
know where our image will be executed. 
there is whole different approach when using scratch , and I will not 
write about it here&lt;/p&gt;
&lt;p&gt;**sometimes official versions dont use '-alpine' , but '-slim' in the 
tagname of the image**&lt;/p&gt;

(2) Remove Unnecessary Packages/Files
&lt;p&gt;after executing image logic - if files are not nesesarry - we can remove the files that used in execution&lt;/p&gt;
**it is importent to remove the files in the same layer *RUN*, since 
once a layer is executed - storage that is clearde will not be reduced**


&lt;p&gt;
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y \
some-package &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;after installing package we can remove the files that are &lt;br&gt;
not neaded manually&lt;br&gt;
the &amp;amp;&amp;amp; add a command after previous comman was executed&lt;br&gt;
all is done in the same &lt;em&gt;RUN&lt;/em&gt; layer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56nbjfc9s4aojpkz82dn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56nbjfc9s4aojpkz82dn.png" alt="Image description" width="381" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(3) remove cache on layers&lt;/p&gt;

&lt;p&gt;
when adding a an argument to Dockerfile , we can then execute the build with dynamic value to this argument 
it prevent caching of layers , which makes build longer , but also clears cached data from image

FROM ....
ARG CACHEBUST=1  # default value
RUN ...
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfnk401ji78w1n0dza5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfnk401ji78w1n0dza5j.png" alt="Image description" width="270" height="76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then when executing build : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa21jra7lro24lih7dv8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa21jra7lro24lih7dv8y.png" alt="Image description" width="433" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(4) remove cache on build&lt;/p&gt;

&lt;p&gt;
when building with --no-cache , we omit cache , just lije in the build ARGUMENTS
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lrukd8zm4uaefn0x5oo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lrukd8zm4uaefn0x5oo.png" alt="Image description" width="271" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(5) Multi-Stage Builds&lt;/p&gt;

&lt;p&gt;
when we use multy stage - we actually use the files in one build , but not saving it to the next build. 

we use the result of the execution as source in a new clean build 
without all of the installations, needed to create this files. 

it is similar to removing files after executing (2)  
however - using this method - we are creating hirarchical flow of the build. 

&lt;/p&gt; 

&lt;p&gt;(6) .dockerignore &lt;/p&gt;

&lt;p&gt;
.dockerignore file is a file created in the same folder as the Dockerfile. in it we list all files that we dont want to add to the 
docker image 
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
.git
*.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4fmm8vwksuh2yirbpg1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4fmm8vwksuh2yirbpg1l.png" alt="Image description" width="553" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(7) 3rd party tools &lt;/p&gt;

&lt;p&gt;
there are known utilities that I use, that 
help configure and sugest slimming docker 
---------------------------------------------
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/wagoodman/dive" rel="noopener noreferrer"&gt;Dive&lt;/a&gt;-&lt;p&gt; tool to analyze Docker image &lt;em&gt;layers&lt;/em&gt; and see what's taking up space.
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/slimtoolkit/slim" rel="noopener noreferrer"&gt;Slim&lt;/a&gt;-&lt;p&gt;This tool analyzes and auto-slims your image by removing unnecessary stuff like:

&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unused files&lt;/li&gt;
&lt;li&gt;Unreachable code paths&lt;/li&gt;
&lt;li&gt;Binaries and debugging tools
&lt;p&gt;
&lt;em&gt;it is ai tool that involved in the build process,m and slim the image by removing unused files&lt;/em&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;example : using dive - &lt;br&gt;
here we can see difference between multi and regular build &lt;br&gt;
we can see that in the regular we have the nodenode-module folder. and we can see diff in sizes of each layer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dive idubi/four-in-a-row_alpine18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx0pkoefavdl13kvdqd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx0pkoefavdl13kvdqd5.png" alt="Image description" width="800" height="467"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dive multi-stage-4_in_a_row:1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfpebgu2so1eezns4bk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfpebgu2so1eezns4bk2.png" alt="Image description" width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h1&gt;
  
  
  conclusion :
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6eson6lwpxj2hwtpj7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6eson6lwpxj2hwtpj7k.png" alt="Image description" width="453" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
in this example I use the first node image (installer) to install and all react packeges. 
then I add the files used in the build of the site. 
the command  : &lt;/p&gt;
&lt;p&gt;

 
``` RUN yarn &amp;amp;&amp;amp; yarn build ```


&lt;/p&gt;
&lt;p&gt; 
install all packages , and then execute build
&lt;/p&gt;
&lt;p&gt;
then, in the 2ND image (deployer)
I install NGINX HTTP server - a slim server, much slimmer then node, since I dont need all of the code compilation capabilities of node. 

then I copy the build files from the node server - which are the only files I need to use in the site
from : /app/dist  ==&amp;gt; to  ==&amp;gt; /usr/share/nginx/html  in deployer image.

and I config expose its port (80) for outer connection (docker access to the image on port 80 of this image)
&lt;/p&gt;

&lt;h2&gt;
  
  
  results : 
&lt;/h2&gt;

&lt;p&gt;the original image (one stage) -  1.2 GB &lt;br&gt;
the multi-staged image         -  280MB&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7jxvofypc0bzji8hkgvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7jxvofypc0bzji8hkgvp.png" alt="Image description" width="800" height="84"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d --name 4inarow-multi -p 8080:80 multi-stage-4_in_a_row:1.1


docker ps 
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS          PORTS                  NAMES
2396e23aa874   multi-stage-4_in_a_row:1.1   "/docker-entrypoint.…"   21 seconds ago   Up 21 seconds   0.0.0.0:8080-&amp;gt;80/tcp   4inarow-multi

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;docker stop 4inarow-multi&lt;br&gt;
docker rm 4inarow-multi &lt;br&gt;
dcoker rmi multi-stage-4_in_a_row:1.1 &lt;/p&gt;

&lt;p&gt;docker tag multi-stage-4_in_a_row:1.1:1.1  idubi/multi-stage-4_in_a_row:latest&lt;br&gt;
docker push idubi/multi-stage-4_in_a_row:latest&lt;/p&gt;

&lt;p&gt;dcoker rmi idubi/four-in-a-row_alpine18:latest&lt;/p&gt;

&lt;h3&gt;
  
  
  now, after deleting it from local, we don't have image with this name and we can get the image from docker-hub ....
&lt;/h3&gt;

&lt;p&gt;docker run -d --name 4inarow-multi -p 8080:80 idubi/four-in-a-row_alpine18:latest&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmyc2us4qlmus96ymaw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmyc2us4qlmus96ymaw1.png" alt="Image description" width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;...  &lt;/p&gt;

&lt;h3&gt;
  
  
  and  now we can see it running
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwwg94wubrdi2lvqb0rm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwwg94wubrdi2lvqb0rm.png" alt="Image description" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>idobistry</category>
      <category>40daysofkubernetes</category>
    </item>
    <item>
      <title>Using Dcokerfile to Dockerize VibeCode Project</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Sun, 20 Apr 2025 03:18:36 +0000</pubDate>
      <link>https://dev.to/idubi/40-days-of-k8s-cka-challenge-0240-1idc</link>
      <guid>https://dev.to/idubi/40-days-of-k8s-cka-challenge-0240-1idc</guid>
      <description>&lt;h2&gt;
  
  
  40 days of K8s - CKA challenge (01/40)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  GIT
&lt;/h2&gt;

&lt;h2&gt;
  
  
  vibe coding - testing my skills
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=nfRsPiRGx74&amp;amp;ab_channel=TechTutorialswithPiyush" rel="noopener noreferrer"&gt;Day 2/40 - How To Dockerize a Project - CKA Full Course 2025&lt;/a&gt;&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;taking the #40DaysOfk8s Challange  is a commitmenet &lt;br&gt;
no doubt about it. &lt;/p&gt;

&lt;p&gt;Day 2 of the challenge brought some important insights:&lt;/p&gt;

&lt;p&gt;Based on a clear understanding of my strengths and limitations, &lt;br&gt;
both in terms of focus and available time: I realized, that the only way I’ll consistently stick to the challenge, is by making it &lt;br&gt;
genuinely interesting for me.&lt;/p&gt;

&lt;p&gt;Sure, complex and technical challenges can be interesting on their own.&lt;br&gt;
But here’s the catch: I need to find the personal challenge, especially in the easy ones ... &lt;/p&gt;

&lt;p&gt;Let’s be honest: writing a Dockerfile isn’t what gets me excite (especially not a straigh forward one ... ) but it is the bread an butter of &lt;em&gt;DevOps&lt;/em&gt;, and on the other side : if I start skipping tasks, or cutting corners, I’ll never finish this challenge.&lt;/p&gt;

&lt;p&gt;So, here’s the formula I’m embracing:&lt;/p&gt;
&lt;h3&gt;
  
  
  Consistency = Engagement = Commitment
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;the only way I am going to stick with it, is determind by the how long i stay interested in it.&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Choosing the Right Project for Presentaition
&lt;/h1&gt;

&lt;p&gt;Early in the day, I asked myself:&lt;/p&gt;

&lt;p&gt;Should I build on one of my many existing projects?&lt;/p&gt;

&lt;p&gt;Or use this opportunity to experiment with something new—maybe a little VibeCoding?&lt;/p&gt;

&lt;p&gt;Truth is, I have a cool project involving Kafka and Redis that I’ll definitely showcase later on.&lt;br&gt;
But for now, I wanted to take today’s relatively simple task and infuse it with creativity&lt;/p&gt;

&lt;p&gt;I decided going on a Vibe programming task - just to make it interesting &lt;br&gt;
I will create a project out of prompting along &lt;br&gt;
and use this code to dockerize my 2nd day challange. &lt;/p&gt;

&lt;p&gt;but wait : how would i work ? I want it to be both consistant and professional &lt;br&gt;
how will I track the progress and follow changes ? &lt;/p&gt;



&lt;p&gt;I decided to &lt;em&gt;FORK&lt;/em&gt; the original repository done by &lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt;. &lt;br&gt;
by doing so, I can later on override it (adding my staff to MY!! forked project) &lt;br&gt;
more then this : &lt;br&gt;
using registration on @piyushsachdev repository events (by &lt;em&gt;GitHub webhoooks&lt;/em&gt; or third party tools , or even manually scheduled automation) I may automate processes to fetch any future changes done by &lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt; in the future. &lt;/p&gt;

&lt;p&gt;this can be done with gitactions that I can implement in my repo &lt;/p&gt;

&lt;p&gt;once you FORK a repo - you get link to the upstream path to the repo that you FORK from &lt;br&gt;
so using fetch from upstrim you can always get the changes done manuall &lt;/p&gt;

&lt;p&gt;you can aloso set manually "upstream" remote link and later fetch from&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add upstream https://github.com/piyushsachdeva/CKA-2024
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after creating upstream you can check existance with :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F13fofdoksz613ih0c812.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F13fofdoksz613ih0c812.png" alt="Image description" width="589" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then can fetch changes anytime manually :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch upstream
git log HEAD..upstream/main --oneline  # shows commits you don't have
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or even with GitHub-Actions  &lt;/p&gt;

&lt;h1&gt;
  
  
  Creating my project - using Vibe-Programming
&lt;/h1&gt;

&lt;p&gt;So i have a forked project. &lt;/p&gt;

&lt;p&gt;now we go to day02 and adding Dockerfile there &lt;br&gt;
this is done by creating a branch for every cahnge - actuially I decided a branch for every day of change &lt;/p&gt;

&lt;p&gt;the dockerfile will be used with build of the docker image, created for my project. &lt;/p&gt;

&lt;p&gt;lets create a project. &lt;/p&gt;

&lt;p&gt;as memtioned earlier : I decided &lt;strong&gt;VIBE CODING&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Vibe_coding" rel="noopener noreferrer"&gt;vibe coding &lt;/a&gt; is a new approach of writing code by asking AI tool to generate it. &lt;/p&gt;

&lt;p&gt;so  I started with the big weapon : &lt;a href="https://base44.com/" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fks6c63175wnzw9ylmc81.png" alt="Image description" width="248" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and asked it with a nice prompt to write me a &lt;em&gt;4 in a row&lt;/em&gt; game :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I want a frontend aplication of 4 in a row a user will start a game against the compuiter the computer will have 8 different levels 2 select - each level is another depth of thinking ( a step forwared , 2 steps forward till 10 steps forward

the game board size ( columns / rows) can be set at initialization with the selection of level

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;that's it &lt;br&gt;
the application was ready to work and I got a game. &lt;/p&gt;

&lt;p&gt;not fully functioning, but good enough ... &lt;/p&gt;

&lt;p&gt;so i continued :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add a new game button and a hint button
allow the user to declare hoe many hints he can get in a game and allow to request as loong as its not ver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;because I felt this was neaded &lt;/p&gt;

&lt;p&gt;... &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; padam padam  : 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;a game was born : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://app--4-connect-ai-8d7e48ac.base44.app/" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpic0p0349h9nshox14qk.png" alt="Image description" width="404" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;that easy &lt;/p&gt;

&lt;p&gt;but the problem is that I couldnt take the code out ... &lt;br&gt;
well, some code was available &lt;br&gt;
but it did not work alone &lt;br&gt;
and the tol didnt let me access to the code .... &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w831or4vb259m9zu7s0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w831or4vb259m9zu7s0.png" alt="Image description" width="140" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;so I decided to use my own work env to vibe programming &lt;br&gt;
I decided to work with openai - just because I trust it the most &lt;br&gt;
I use AI a lot (even wrote some experts ...) and I use well &lt;br&gt;
I use it to create movies and pictures , to generate data and even to generate enhanced prompts ... &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F083n4076i38ckmephw5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F083n4076i38ckmephw5b.png" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could use the agent ability of the copilot, but I wanted to use manual progress with chatgpt - to monitor its progress and way of thinking (after all - as I mentioned before : I trust it the most)&lt;/p&gt;

&lt;p&gt;but not only : after decided to work with GPT , I decided totake the product tcreated with it and pass it throught copilot pair programming tool and the windsurf (codium) addon as well &lt;/p&gt;

&lt;p&gt;so I actually used 3 different tools to creat this code : .... &lt;/p&gt;
&lt;h2&gt;
  
  
  Workflow with GPT + Copilot + windsurf
&lt;/h2&gt;

&lt;p&gt;I asked GPT to start &lt;br&gt;
I asked it to create a 4-in-a-row aplication, I even added a printscreen of the setting window (created by base44)&lt;/p&gt;

&lt;p&gt;after describing to request - I asked it to generate the filetree of the prooject &lt;br&gt;
I also asked it to create the tree with bash script &lt;/p&gt;

&lt;p&gt;then I asked it to write to me 10 questions that it might think that are need to accomplish the task &lt;/p&gt;

&lt;p&gt;thne , asked it to write all files , and added : before each file write the name of the file in remark ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#vibe programming - Real-Time Code Generation - 4InARow - react 

I want you to help me create a full react application for a 4 in a row game 

the game has this opening screen (see attached) 

the game is against computer. 

on setting screen the user can selecti the difficulty level (which is how many steps the oponent computer can calculate ahead), the rows and columns (for board) , the number of hints a user can ask the computer to hint him for the best next move he can do . 

while playing - each time the user request a hint - the number of available hints reduces 

pls ask me any question before start 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc6h8gkw3nhlsnu9nvy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc6h8gkw3nhlsnu9nvy8.png" alt="Image description" width="800" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it asked me question - on which i answered ... &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24fvzfqh4gnefjj3bbmi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24fvzfqh4gnefjj3bbmi.png" alt="Image description" width="543" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then after some inquieries I declared the AI computer algorithm of game : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffk31k4qgfx22pg3iiwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffk31k4qgfx22pg3iiwy.png" alt="Image description" width="800" height="132"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pls add filetree for the project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla1a0bk3i3euw95l5d5u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla1a0bk3i3euw95l5d5u.png" alt="Image description" width="747" height="527"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it had some game logistics issues which I ansered and the nit started to work &lt;/p&gt;

&lt;p&gt;it went into canvas mode.&lt;br&gt;&lt;br&gt;
and then streted writing files &lt;br&gt;
and deleting them &lt;br&gt;
and rewriting them again and deleating again &lt;/p&gt;

&lt;p&gt;for several minutes, with stops between .... &lt;/p&gt;

&lt;p&gt;and at the end created files that I decided to copy and paste (I could asked it to generate a zip file , but wanted to follow it manually .... )&lt;/p&gt;

&lt;p&gt;so i copied all script to the right files ... &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mp7evldyrwedv0x8u5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mp7evldyrwedv0x8u5l.png" alt="Image description" width="648" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;after having this files - I asked also to genearate package.json &lt;br&gt;
and the with the created code I faced to the other co-workers : &lt;br&gt;
windsurf and copilot &lt;/p&gt;

&lt;p&gt;over here it was a bit simpler - since they are embedded inside the vscode (also in cursor ... )&lt;/p&gt;

&lt;p&gt;so I asked it (both)  to identefy the project files and add bootstrap correctly ... &lt;/p&gt;

&lt;p&gt;it added some coded  for bootstrapping &lt;br&gt;
and staff &lt;/p&gt;

&lt;p&gt;and some changes in aths of components that are not created in the right path ... &lt;/p&gt;

&lt;p&gt;and thisis it ... &lt;/p&gt;

&lt;p&gt;I have a working project ... &lt;/p&gt;

&lt;p&gt;i created the git repo for it and pushed it ther &lt;/p&gt;

&lt;p&gt;not inside my  #40DaysOfK8s challange repo , but outside of it &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/idubi/4-in-a-row" rel="noopener noreferrer"&gt;4-in-a-row&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  adding a subproject to Github repo
&lt;/h1&gt;

&lt;p&gt;working with the #40DaysOfK8s challange repo - I wanted to maintain this repo clear to its purpose &lt;br&gt;
no other repositories need to reside inside. &lt;/p&gt;

&lt;p&gt;if I have this 4-in-a-row project - and I want to change it later on - i will not change it in #40DaysOfK8s repo. &lt;br&gt;
more then this :  I dont want to maintain other repos in this one repo. &lt;/p&gt;

&lt;p&gt;but I do need to keep this repo files inside Day02 folder - sicne I ant to creatre a docker image for it &lt;/p&gt;

&lt;p&gt;solution &lt;em&gt;Git submoduled&lt;/em&gt;&lt;/p&gt;



&lt;br&gt;
&lt;a href="https://github.blog/open-source/git/working-with-submodules/" rel="noopener noreferrer"&gt;&lt;em&gt;Git submodules&lt;/em&gt;&lt;/a&gt;  are actually links to a real repository. it is an ideal solution to components development when you dont want to duplicate your components in several projects in your organization. &lt;br&gt;
 unlkike subtrees that are actually copies of specific repo - this acts like links to another repo 

&lt;p&gt;like other objects - you can set git hooks to monitor the real repo changes and according to this to update the files in the linked submodule&lt;/p&gt;

&lt;p&gt;creation of submodule is pretty straight forward : &lt;br&gt;
go to the path of the repo where you wantto create the submodule :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; cd ./Resources/Day02
 git submodule add https://github.com/idubi/4-in-a-row.git 4-in-a-row
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsebpzk1flhkp6wtrvjr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsebpzk1flhkp6wtrvjr.png" alt="Image description" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h1&gt;
  
  
  Building Docker Image steps for deployment
&lt;/h1&gt;

&lt;p&gt;now we need to build the Docker image for deployment. &lt;br&gt;
this are the steps : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;crate a Dockerfile for deployment of react application 4_in_a_row&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;sicne  the application is at "4-in-a-row: directory&lt;br&gt;
the dockerfile looks like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:18-alpine
WORKDIR /app
COPY ./4-in-a-row .
RUN yarn &amp;amp;&amp;amp; yarn build
CMD [ "yarn", "start" ]
EXPOSE 5173
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;since the react is packed with vite - the commands to execute the execution of react are different : &lt;br&gt;
       RUN yarn &amp;amp;&amp;amp; yarn build&lt;br&gt;
       CMD [ "yarn", "start" ]&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;build the image with Dockerfile
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build . -t four-in-a-row_alpine18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe59t3diqo4v968a6sli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe59t3diqo4v968a6sli.png" alt="Image description" width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run the image locally to make suer you have it runing
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d --name 4inarow2 -p 5173:5173 four-in-a-row_alpine18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and make sure the aplcation is working : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4v3jnonw231e5w43bpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4v3jnonw231e5w43bpu.png" alt="Image description" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibmuwfoynljavedrbcdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibmuwfoynljavedrbcdt.png" alt="Image description" width="652" height="673"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tag the image for uniquenes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker tag four-in-a-row_alpine18:latest idubi/four-in-a-row_alpine18:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;push the image to docker repository (for now Docker-Hub)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker push idubi/four-in-a-row_alpine18:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhzyyr7ptxpmp6uocn97.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhzyyr7ptxpmp6uocn97.png" alt="Image description" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;delete the image from local dcoker and pull the docker image 
this is done to make sure pull works and run correctly (the pull is done from repository)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker rm -f 4inarow2 
docker rmi four-in-a-row_alpine18:latest

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;make sure no image and no container left : &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05590h87fw1p3t6vfmcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05590h87fw1p3t6vfmcc.png" alt="Image description" width="571" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;execute docker run with deployed image (idubi/four-in-a-row_alpine18:latest)
and make sure it is up and running
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d --name test -p=5173:5173 idubi/four-in-a-row_alpine18:latest 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3kepe4t1qyyhohwc5ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3kepe4t1qyyhohwc5ji.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ifor3rprgbc01pc521w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ifor3rprgbc01pc521w.png" alt="Image description" width="658" height="732"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;br&gt;&lt;br&gt;
if anyone want me to go on either of the subjects I discussed here  please write in comments : 

&lt;ul&gt;
&lt;li&gt;github actions , hooks , 3rd party ... &lt;/li&gt;
&lt;li&gt;github submodule / subtree &lt;/li&gt;
&lt;li&gt;different AI approaches for the AI game setting -

&lt;ul&gt;
&lt;li&gt;what is a deep learnign model. &lt;/li&gt;
&lt;li&gt;how we can train a machine&lt;/li&gt;
&lt;li&gt;how to train a model using Reinforcmeent learnign approaches &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;





</description>
      <category>devops</category>
      <category>github</category>
      <category>vibecoding</category>
      <category>40daysofkubernetes</category>
    </item>
    <item>
      <title>Docker Fundamentals - 40 days of K8s - CKA challenge</title>
      <dc:creator>ido bistry</dc:creator>
      <pubDate>Fri, 18 Apr 2025 02:15:57 +0000</pubDate>
      <link>https://dev.to/idubi/40-days-of-k8s-cka-chalange-0140-36k1</link>
      <guid>https://dev.to/idubi/40-days-of-k8s-cka-chalange-0140-36k1</guid>
      <description>&lt;h2&gt;
  
  
  40 days of K8s - CKA challenge (01/40)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Docker Fundamentals
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=ul96dslvVwY&amp;amp;ab_channel=TechTutorialswithPiyush" rel="noopener noreferrer"&gt;Docker Tutorial For Beginners - Docker Fundamentals - CKA Full Course 2025&lt;/a&gt;&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/piyushsachdeva"&gt;@piyushsachdeva&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;explaining the docker life sycle &lt;/p&gt;

&lt;p&gt;created a diagram and explainng it : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;##  Docker Architecture Diagram u&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxr8d5b3xb5z9vyeqwqe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxr8d5b3xb5z9vyeqwqe.png" alt="Image description" width="655" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;we can see that the docker images are all can be hosted in one host machine. &lt;br&gt;
this machine has its own OS and virtualization layer that allow the docker images exist - each one on its own resources. &lt;br&gt;
each container has its app running on its own OS thatcan be of any kind&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Docker Workflow&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2fih0x5sk8v54e0lg55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2fih0x5sk8v54e0lg55.png" alt="Image description" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the lifecycle of docker image as described in the diagram : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;created as a Dockerfile  that then pushed to a version control repo &lt;/li&gt;
&lt;li&gt;then we build the image from Dockerfile to make sure it run in the dev env &lt;/li&gt;
&lt;li&gt;after making sure the image works - we push it then to docker repository&lt;/li&gt;
&lt;li&gt;test env will use the docker image by pulling it and then running it &lt;/li&gt;
&lt;li&gt;after the test approves the docker image - the production will then use it same as test - by pulling it and running it (which can be achived in 1 command : docker run)&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>40daysofkubernetes</category>
      <category>idobistry</category>
    </item>
  </channel>
</rss>
