[{"data":1,"prerenderedAt":2356},["ShallowReactive",2],{"blog-kubernetes":3},{"id":4,"title":5,"body":6,"date":2341,"description":2342,"draft":2343,"extension":2344,"image":23,"meta":2345,"navigation":814,"path":2346,"seo":2347,"stem":2348,"tags":2349,"__hash__":2355},"blogs\u002Fblogs\u002Fkubernetes\u002Findex.md","Getting Started with Kubernetes for Developers",{"type":7,"value":8,"toc":2309},"minimark",[9,17,24,35,38,43,153,156,214,217,221,224,227,232,240,244,252,258,260,264,267,271,285,291,295,319,324,328,349,354,358,371,376,380,402,407,411,432,437,441,465,470,472,476,483,486,494,602,606,722,726,761,765,888,891,902,911,1060,1065,1086,1091,1106,1109,1193,1195,1199,1203,1661,1665,1964,1968,2146,2150,2217,2221,2228,2232,2289,2293,2296,2299,2302,2305],[10,11,12,16],"p",{},[13,14,15],"strong",{},"Kubernetes"," also known as K8s is an open-source container orchestration system for automating software deployment, scaling, and management.",[10,18,19],{},[20,21],"img",{"alt":22,"src":23},"k8s logo","\u002Fimages\u002Fblogs\u002Fkubernetes\u002Fk8s-logo.png",[10,25,26,27,34],{},"Originally designed by Google, the project is now maintained by a worldwide community of contributors and the trademark is held by the ",[28,29,33],"a",{"href":30,"rel":31},"https:\u002F\u002Fwww.cncf.io",[32],"nofollow","CNCF","(Cloud Native Computing Foundation).",[10,36,37],{},"Kubernetes assembles one or more computers, either virtual machines or bare metal, into a cluster which can run workloads in containers.",[39,40,42],"h2",{"id":41},"what-features-does-it-provide","What features does it provide ?",[44,45,46,59,70,84,102,113,136],"ol",{},[47,48,49,50],"li",{},"Container Orchestration",[51,52,53,56],"ul",{},[47,54,55],{},"Automatically schedules and runs containers across a cluster of machines.",[47,57,58],{},"Abstracts away the infrastructure — developers just define what the app needs (YAML), Kubernetes handles the rest.",[47,60,61,62],{},"Declarative Infrastructure",[51,63,64,67],{},[47,65,66],{},"Everything in K8s is defined as YAML manifests.",[47,68,69],{},"Developers describe the desired state, and K8s ensures the system matches that.",[47,71,72,73],{},"Self-Healing",[51,74,75,78,81],{},[47,76,77],{},"Automatically restarts failed containers",[47,79,80],{},"Reschedules Pods if a Node dies",[47,82,83],{},"Replaces containers if the health check fails",[47,85,86,87],{},"Health checks",[51,88,89,96],{},[47,90,91,95],{},[92,93,94],"code",{},"readinessProbe",": Tells K8s when the app is ready to serve traffic",[47,97,98,101],{},[92,99,100],{},"livenessProbe",": Restarts app if it hangs or crashes",[47,103,104,105],{},"Rolling Updates and Rollbacks",[51,106,107,110],{},[47,108,109],{},"Updates can be applied gradually with zero downtime",[47,111,112],{},"Easy rollback to previous versions if the new one fails",[47,114,115,116],{},"Services and Networking",[51,117,118,125],{},[47,119,120,121,124],{},"Internal DNS service discovery (e.g: ",[92,122,123],{},"my-service.default.svc.cluster.local",")",[47,126,127,128],{},"Supports:\n",[51,129,130,133],{},[47,131,132],{},"ClusterIP (default, internal-only)",[47,134,135],{},"NodePort, LoadBalancer, Ingress, GatewayAPI for external access",[47,137,138,139],{},"Secrets and ConfigMaps",[51,140,141,147],{},[47,142,143,146],{},[92,144,145],{},"ConfigMap",": Inject environment variables or config files into containers",[47,148,149,152],{},[92,150,151],{},"Secret",": Securely store API keys, passwords, etc.",[10,154,155],{},"Developers should never hardcode secrets — use these instead.",[44,157,159,170,181,192],{"start":158},8,[47,160,161,162],{},"Volumes and Persistent Storage",[51,163,164,167],{},[47,165,166],{},"Store data outside containers via PersistentVolumeClaims (PVCs)",[47,168,169],{},"Good for databases or any app that needs persistent state",[47,171,172,173],{},"Namespaces",[51,174,175,178],{},[47,176,177],{},"Isolate environments (e.g., dev, staging, prod) within a single cluster",[47,179,180],{},"Developers can test without affecting production",[47,182,183,184],{},"RBAC (Role-Based Access Control)",[51,185,186,189],{},[47,187,188],{},"Controls who can deploy, read logs, access resources",[47,190,191],{},"Essential for teams — especially on shared clusters",[47,193,194,195],{},"Observability",[51,196,197,211],{},[47,198,199,200],{},"Native support for:\n",[51,201,202,208],{},[47,203,204,205,124],{},"Logs (",[92,206,207],{},"kubectl logs",[47,209,210],{},"Metrics (via Prometheus)",[47,212,213],{},"Great for debugging and monitoring performance.",[215,216],"hr",{},[39,218,220],{"id":219},"what-is-a-kubernetes-cluster","What is a Kubernetes Cluster ?",[10,222,223],{},"A Kubernetes cluster is a group of computers (called nodes) that work together to run your containerized applications. These nodes can be real machines or virtual ones.",[10,225,226],{},"There are two types of nodes in a Kubernetes cluster:",[228,229,231],"h3",{"id":230},"_1-master-node-control-plane","1. Master node (Control Plane):",[51,233,234,237],{},[47,235,236],{},"Think of it as the brain of the cluster.",[47,238,239],{},"It makes decisions, like where to run applications, handles scheduling, and keeps track of everything.",[228,241,243],{"id":242},"_2-worker-nodes","2. Worker nodes:",[51,245,246,249],{},[47,247,248],{},"These are the machines that actually run your apps inside containers.",[47,250,251],{},"Each worker node has a Kubelet (agent), a container runtime (like Docker or containerd), and tools for networking and monitoring.",[10,253,254],{},[20,255],{"alt":256,"src":257},"k8s architecture","\u002Fimages\u002Fblogs\u002Fkubernetes\u002Fk8s-architecture.png",[215,259],{},[39,261,263],{"id":262},"key-components-architecture","Key Components ( Architecture )",[10,265,266],{},"A Kubernetes cluster has many parts working together behind the scenes. Let’s break down the core components we should know:",[228,268,270],{"id":269},"_1-api-server","1. API Server",[51,272,273,276,279,282],{},[47,274,275],{},"Location: Control Plane",[47,277,278],{},"Acts as the front door of the Kubernetes cluster.",[47,280,281],{},"All communication (from users, CLI tools like kubectl, or even internal components) goes through the API Server.",[47,283,284],{},"It processes REST requests, validates them, and updates the cluster state in etcd.",[286,287,288],"blockquote",{},[10,289,290],{},"Think of it as the receptionist of a company — every request passes through it first.",[228,292,294],{"id":293},"_2-scheduler","2. Scheduler",[51,296,297,299,302,316],{},[47,298,275],{},[47,300,301],{},"Responsible for assigning Pods to Nodes.",[47,303,304,305],{},"It looks at:\n",[51,306,307,310,313],{},[47,308,309],{},"Resource requirements (CPU, memory)",[47,311,312],{},"Node availability",[47,314,315],{},"Taints\u002Ftolerations and affinities",[47,317,318],{},"It chooses the best node for each pod and tells the API server its decision.",[286,320,321],{},[10,322,323],{},"Like a delivery manager assigning packages to the nearest delivery person.",[228,325,327],{"id":326},"_3-conroller-manager","3. Conroller manager",[51,329,330,332,335],{},[47,331,275],{},[47,333,334],{},"Watches the cluster state and makes sure the current state matches the desired state (defined in YAML files).",[47,336,337,338],{},"Contains multiple controllers:\n",[51,339,340,343,346],{},[47,341,342],{},"Node Controller – watches node health",[47,344,345],{},"ReplicaSet Controller – ensures the right number of pods are running",[47,347,348],{},"Job Controller, DaemonSet Controller, etc.",[286,350,351],{},[10,352,353],{},"Imagine a robot checking every 5 seconds if your to-do list is being followed, and fixing anything that's off.",[228,355,357],{"id":356},"_4-etcd","4. etcd",[51,359,360,362,365,368],{},[47,361,275],{},[47,363,364],{},"A fast, distributed key-value store used as Kubernetes’ backbone database.",[47,366,367],{},"Stores all cluster data — deployments, state of pods, secrets, config maps, etc",[47,369,370],{},"Highly consistent and supports snapshots\u002Fbackup.",[286,372,373],{},[10,374,375],{},"If the API server is the receptionist, etcd is the filing cabinet where everything is saved.",[228,377,379],{"id":378},"_5-kubelet","5. Kubelet",[51,381,382,385,388],{},[47,383,384],{},"Location: Each Worker Node",[47,386,387],{},"An agent that runs on every worker node.",[47,389,390,391],{},"It takes instructions from the API server and:\n",[51,392,393,396,399],{},[47,394,395],{},"Ensures containers are running",[47,397,398],{},"Monitors pod health",[47,400,401],{},"Reports back to the control plane",[286,403,404],{},[10,405,406],{},"Like a local manager on each node making sure everything is working as planned.",[228,408,410],{"id":409},"_6-kube-proxy","6. Kube-proxy",[51,412,413,415,418],{},[47,414,384],{},[47,416,417],{},"Manages networking and communication in the cluster.",[47,419,420,421],{},"Handles:\n",[51,422,423,426,429],{},[47,424,425],{},"Routing traffic to the correct pod\u002Fservice",[47,427,428],{},"Load balancing",[47,430,431],{},"NAT rules for service access",[286,433,434],{},[10,435,436],{},"Think of it as the node’s network engineer — setting up all the traffic rules so things run smoothly.",[228,438,440],{"id":439},"_7-container-runtime","7. Container runtime",[51,442,443,445,448,462],{},[47,444,384],{},[47,446,447],{},"Software that actually runs containers on a system.",[47,449,450,451],{},"Kubernetes supports several runtimes:\n",[51,452,453,456,459],{},[47,454,455],{},"Docker (deprecated)",[47,457,458],{},"containerd",[47,460,461],{},"CRI-O",[47,463,464],{},"Kubelet communicates with this runtime to start\u002Fstop containers.",[286,466,467],{},[10,468,469],{},"It's the engine that powers and runs your containers, like Docker or containerd.",[215,471],{},[39,473,475],{"id":474},"local-k8s-cluster-setup","Local K8s cluster setup",[10,477,478,479,482],{},"We are going to use docker containers as a nodes and ",[92,480,481],{},"kind"," to setup the cluster.",[10,484,485],{},"To create a local k8s cluster we need following tools installed in our system.",[228,487,489,490],{"id":488},"_1-docker","1. ",[28,491,493],{"href":492},"\u002Fblogs\u002Fvirtualization_containers_and_role_of_docker_in_it\u002F#docker-installation-on-linux","Docker",[51,495,496,532,579],{},[47,497,498,499],{},"Installation\n",[500,501,506],"pre",{"className":502,"code":503,"language":504,"meta":505,"style":505},"language-bash shiki shiki-themes github-light","curl -fsSL https:\u002F\u002Fget.docker.com | sh\n","bash","",[92,507,508],{"__ignoreMap":505},[509,510,513,517,521,525,529],"span",{"class":511,"line":512},"line",1,[509,514,516],{"class":515},"s7eDp","curl",[509,518,520],{"class":519},"sYu0t"," -fsSL",[509,522,524],{"class":523},"sYBdl"," https:\u002F\u002Fget.docker.com",[509,526,528],{"class":527},"sD7c4"," |",[509,530,531],{"class":515}," sh\n",[47,533,534,535,538],{},"Allow running docker without ",[92,536,537],{},"sudo",[500,539,541],{"className":502,"code":540,"language":504,"meta":505,"style":505},"sudo groupadd docker\nsudo usermod -aG docker $USER\nnewgrp docker\n",[92,542,543,553,571],{"__ignoreMap":505},[509,544,545,547,550],{"class":511,"line":512},[509,546,537],{"class":515},[509,548,549],{"class":523}," groupadd",[509,551,552],{"class":523}," docker\n",[509,554,556,558,561,564,567],{"class":511,"line":555},2,[509,557,537],{"class":515},[509,559,560],{"class":523}," usermod",[509,562,563],{"class":519}," -aG",[509,565,566],{"class":523}," docker",[509,568,570],{"class":569},"sgsFI"," $USER\n",[509,572,574,577],{"class":511,"line":573},3,[509,575,576],{"class":515},"newgrp",[509,578,552],{"class":523},[47,580,581,582,585,586],{},"Run a ",[92,583,584],{},"hello-world"," image\n",[500,587,589],{"className":502,"code":588,"language":504,"meta":505,"style":505},"docker run hello-world\n",[92,590,591],{"__ignoreMap":505},[509,592,593,596,599],{"class":511,"line":512},[509,594,595],{"class":515},"docker",[509,597,598],{"class":523}," run",[509,600,601],{"class":523}," hello-world\n",[228,603,605],{"id":604},"_2-kubectl","2. Kubectl",[51,607,608,706],{},[47,609,498,610],{},[500,611,613],{"className":502,"code":612,"language":504,"meta":505,"style":505},"curl -LO \"https:\u002F\u002Fdl.k8s.io\u002Frelease\u002F$(curl -L -s https:\u002F\u002Fdl.k8s.io\u002Frelease\u002Fstable.txt)\u002Fbin\u002Flinux\u002Famd64\u002Fkubectl\"\ncurl -LO \"https:\u002F\u002Fdl.k8s.io\u002Frelease\u002F$(curl -L -s https:\u002F\u002Fdl.k8s.io\u002Frelease\u002Fstable.txt)\u002Fbin\u002Flinux\u002Famd64\u002Fkubectl.sha256\"\necho \"$(cat kubectl.sha256)  kubectl\" | sha256sum --check\nsudo install -o root -g root -m 0755 kubectl \u002Fusr\u002Flocal\u002Fbin\u002Fkubectl\n",[92,614,615,636,653,675],{"__ignoreMap":505},[509,616,617,619,622,625,627,630,633],{"class":511,"line":512},[509,618,516],{"class":515},[509,620,621],{"class":519}," -LO",[509,623,624],{"class":523}," \"https:\u002F\u002Fdl.k8s.io\u002Frelease\u002F$(",[509,626,516],{"class":515},[509,628,629],{"class":519}," -L",[509,631,632],{"class":519}," -s",[509,634,635],{"class":523}," https:\u002F\u002Fdl.k8s.io\u002Frelease\u002Fstable.txt)\u002Fbin\u002Flinux\u002Famd64\u002Fkubectl\"\n",[509,637,638,640,642,644,646,648,650],{"class":511,"line":555},[509,639,516],{"class":515},[509,641,621],{"class":519},[509,643,624],{"class":523},[509,645,516],{"class":515},[509,647,629],{"class":519},[509,649,632],{"class":519},[509,651,652],{"class":523}," https:\u002F\u002Fdl.k8s.io\u002Frelease\u002Fstable.txt)\u002Fbin\u002Flinux\u002Famd64\u002Fkubectl.sha256\"\n",[509,654,655,658,661,664,667,669,672],{"class":511,"line":573},[509,656,657],{"class":519},"echo",[509,659,660],{"class":523}," \"$(",[509,662,663],{"class":515},"cat",[509,665,666],{"class":523}," kubectl.sha256)  kubectl\"",[509,668,528],{"class":527},[509,670,671],{"class":515}," sha256sum",[509,673,674],{"class":519}," --check\n",[509,676,678,680,683,686,689,692,694,697,700,703],{"class":511,"line":677},4,[509,679,537],{"class":515},[509,681,682],{"class":523}," install",[509,684,685],{"class":519}," -o",[509,687,688],{"class":523}," root",[509,690,691],{"class":519}," -g",[509,693,688],{"class":523},[509,695,696],{"class":519}," -m",[509,698,699],{"class":519}," 0755",[509,701,702],{"class":523}," kubectl",[509,704,705],{"class":523}," \u002Fusr\u002Flocal\u002Fbin\u002Fkubectl\n",[47,707,708,709],{},"Check version\n",[500,710,712],{"className":502,"code":711,"language":504,"meta":505,"style":505},"kubectl version\n",[92,713,714],{"__ignoreMap":505},[509,715,716,719],{"class":511,"line":512},[509,717,718],{"class":515},"kubectl",[509,720,721],{"class":523}," version\n",[228,723,725],{"id":724},"_3-helm","3. Helm",[51,727,728,747],{},[47,729,498,730],{},[500,731,733],{"className":502,"code":732,"language":504,"meta":505,"style":505},"curl https:\u002F\u002Fraw.githubusercontent.com\u002Fhelm\u002Fhelm\u002Fmain\u002Fscripts\u002Fget-helm-3 | bash\n",[92,734,735],{"__ignoreMap":505},[509,736,737,739,742,744],{"class":511,"line":512},[509,738,516],{"class":515},[509,740,741],{"class":523}," https:\u002F\u002Fraw.githubusercontent.com\u002Fhelm\u002Fhelm\u002Fmain\u002Fscripts\u002Fget-helm-3",[509,743,528],{"class":527},[509,745,746],{"class":515}," bash\n",[47,748,708,749],{},[500,750,752],{"className":502,"code":751,"language":504,"meta":505,"style":505},"helm version\n",[92,753,754],{"__ignoreMap":505},[509,755,756,759],{"class":511,"line":512},[509,757,758],{"class":515},"helm",[509,760,721],{"class":523},[228,762,764],{"id":763},"_4-kind","4. Kind",[51,766,767,875],{},[47,768,498,769],{},[500,770,772],{"className":502,"code":771,"language":504,"meta":505,"style":505},"# For AMD64 \u002F x86_64\n[ $(uname -m) = x86_64 ] && curl -Lo .\u002Fkind https:\u002F\u002Fkind.sigs.k8s.io\u002Fdl\u002Fv0.29.0\u002Fkind-linux-amd64\n\n# For ARM64\n[ $(uname -m) = aarch64 ] && curl -Lo .\u002Fkind https:\u002F\u002Fkind.sigs.k8s.io\u002Fdl\u002Fv0.29.0\u002Fkind-linux-arm64\n\nchmod +x .\u002Fkind\nsudo mv .\u002Fkind \u002Fusr\u002Flocal\u002Fbin\u002Fkind\n",[92,773,774,780,810,816,821,846,851,863],{"__ignoreMap":505},[509,775,776],{"class":511,"line":512},[509,777,779],{"class":778},"sAwPA","# For AMD64 \u002F x86_64\n",[509,781,782,785,788,790,793,796,799,801,804,807],{"class":511,"line":555},[509,783,784],{"class":569},"[ $(",[509,786,787],{"class":515},"uname",[509,789,696],{"class":519},[509,791,792],{"class":569},") ",[509,794,795],{"class":527},"=",[509,797,798],{"class":569}," x86_64 ] && ",[509,800,516],{"class":515},[509,802,803],{"class":519}," -Lo",[509,805,806],{"class":523}," .\u002Fkind",[509,808,809],{"class":523}," https:\u002F\u002Fkind.sigs.k8s.io\u002Fdl\u002Fv0.29.0\u002Fkind-linux-amd64\n",[509,811,812],{"class":511,"line":573},[509,813,815],{"emptyLinePlaceholder":814},true,"\n",[509,817,818],{"class":511,"line":677},[509,819,820],{"class":778},"# For ARM64\n",[509,822,824,826,828,830,832,834,837,839,841,843],{"class":511,"line":823},5,[509,825,784],{"class":569},[509,827,787],{"class":515},[509,829,696],{"class":519},[509,831,792],{"class":569},[509,833,795],{"class":527},[509,835,836],{"class":569}," aarch64 ] && ",[509,838,516],{"class":515},[509,840,803],{"class":519},[509,842,806],{"class":523},[509,844,845],{"class":523}," https:\u002F\u002Fkind.sigs.k8s.io\u002Fdl\u002Fv0.29.0\u002Fkind-linux-arm64\n",[509,847,849],{"class":511,"line":848},6,[509,850,815],{"emptyLinePlaceholder":814},[509,852,854,857,860],{"class":511,"line":853},7,[509,855,856],{"class":515},"chmod",[509,858,859],{"class":523}," +x",[509,861,862],{"class":523}," .\u002Fkind\n",[509,864,865,867,870,872],{"class":511,"line":158},[509,866,537],{"class":515},[509,868,869],{"class":523}," mv",[509,871,806],{"class":523},[509,873,874],{"class":523}," \u002Fusr\u002Flocal\u002Fbin\u002Fkind\n",[47,876,708,877],{},[500,878,880],{"className":502,"code":879,"language":504,"meta":505,"style":505},"kind version\n",[92,881,882],{"__ignoreMap":505},[509,883,884,886],{"class":511,"line":512},[509,885,481],{"class":515},[509,887,721],{"class":523},[10,889,890],{},"Now we have everything installed on our system for cluster setup.",[10,892,893,894,897,898,901],{},"Let's create a k8s cluster which will have ",[92,895,896],{},"1 Master"," and ",[92,899,900],{},"2 Worker"," node",[44,903,904],{},[47,905,906,907,910],{},"Create a ",[92,908,909],{},"kind-config.yaml"," file and copy paste the below content",[500,912,916],{"className":913,"code":914,"language":915,"meta":505,"style":505},"language-yaml shiki shiki-themes github-light","kind: Cluster\napiVersion: kind.x-k8s.io\u002Fv1alpha4\nnodes:\n- role: control-plane\n  extraPortMappings:\n      - containerPort: 30080\n        hostPort: 30080   # Map container's port 30080 to host's port 30080\n        protocol: TCP\n      - containerPort: 30443\n        hostPort: 30443  # Map container's port 30443 to host's port 30443\n        protocol: TCP\n- role: worker\n- role: worker\n","yaml",[92,917,918,929,939,947,960,967,980,993,1003,1015,1028,1037,1049],{"__ignoreMap":505},[509,919,920,923,926],{"class":511,"line":512},[509,921,481],{"class":922},"shJU0",[509,924,925],{"class":569},": ",[509,927,928],{"class":523},"Cluster\n",[509,930,931,934,936],{"class":511,"line":555},[509,932,933],{"class":922},"apiVersion",[509,935,925],{"class":569},[509,937,938],{"class":523},"kind.x-k8s.io\u002Fv1alpha4\n",[509,940,941,944],{"class":511,"line":573},[509,942,943],{"class":922},"nodes",[509,945,946],{"class":569},":\n",[509,948,949,952,955,957],{"class":511,"line":677},[509,950,951],{"class":569},"- ",[509,953,954],{"class":922},"role",[509,956,925],{"class":569},[509,958,959],{"class":523},"control-plane\n",[509,961,962,965],{"class":511,"line":823},[509,963,964],{"class":922},"  extraPortMappings",[509,966,946],{"class":569},[509,968,969,972,975,977],{"class":511,"line":848},[509,970,971],{"class":569},"      - ",[509,973,974],{"class":922},"containerPort",[509,976,925],{"class":569},[509,978,979],{"class":519},"30080\n",[509,981,982,985,987,990],{"class":511,"line":853},[509,983,984],{"class":922},"        hostPort",[509,986,925],{"class":569},[509,988,989],{"class":519},"30080",[509,991,992],{"class":778},"   # Map container's port 30080 to host's port 30080\n",[509,994,995,998,1000],{"class":511,"line":158},[509,996,997],{"class":922},"        protocol",[509,999,925],{"class":569},[509,1001,1002],{"class":523},"TCP\n",[509,1004,1006,1008,1010,1012],{"class":511,"line":1005},9,[509,1007,971],{"class":569},[509,1009,974],{"class":922},[509,1011,925],{"class":569},[509,1013,1014],{"class":519},"30443\n",[509,1016,1018,1020,1022,1025],{"class":511,"line":1017},10,[509,1019,984],{"class":922},[509,1021,925],{"class":569},[509,1023,1024],{"class":519},"30443",[509,1026,1027],{"class":778},"  # Map container's port 30443 to host's port 30443\n",[509,1029,1031,1033,1035],{"class":511,"line":1030},11,[509,1032,997],{"class":922},[509,1034,925],{"class":569},[509,1036,1002],{"class":523},[509,1038,1040,1042,1044,1046],{"class":511,"line":1039},12,[509,1041,951],{"class":569},[509,1043,954],{"class":922},[509,1045,925],{"class":569},[509,1047,1048],{"class":523},"worker\n",[509,1050,1052,1054,1056,1058],{"class":511,"line":1051},13,[509,1053,951],{"class":569},[509,1055,954],{"class":922},[509,1057,925],{"class":569},[509,1059,1048],{"class":523},[44,1061,1062],{"start":555},[47,1063,1064],{},"Run below command to create cluster",[500,1066,1068],{"className":502,"code":1067,"language":504,"meta":505,"style":505},"kind create cluster --config kind-config.yaml\n",[92,1069,1070],{"__ignoreMap":505},[509,1071,1072,1074,1077,1080,1083],{"class":511,"line":512},[509,1073,481],{"class":515},[509,1075,1076],{"class":523}," create",[509,1078,1079],{"class":523}," cluster",[509,1081,1082],{"class":519}," --config",[509,1084,1085],{"class":523}," kind-config.yaml\n",[44,1087,1088],{"start":573},[47,1089,1090],{},"Check nodes",[500,1092,1094],{"className":502,"code":1093,"language":504,"meta":505,"style":505},"kubectl get nodes\n",[92,1095,1096],{"__ignoreMap":505},[509,1097,1098,1100,1103],{"class":511,"line":512},[509,1099,718],{"class":515},[509,1101,1102],{"class":523}," get",[509,1104,1105],{"class":523}," nodes\n",[10,1107,1108],{},"Output:",[500,1110,1112],{"className":502,"code":1111,"language":504,"meta":505,"style":505},"NAME                 STATUS   ROLES           AGE   VERSION\nkind-control-plane   Ready    control-plane   21m   v1.33.1\nkind-worker          Ready    \u003Cnone>          21m   v1.33.1\nkind-worker2         Ready    \u003Cnone>          21m   v1.33.1\n",[92,1113,1114,1131,1148,1173],{"__ignoreMap":505},[509,1115,1116,1119,1122,1125,1128],{"class":511,"line":512},[509,1117,1118],{"class":515},"NAME",[509,1120,1121],{"class":523},"                 STATUS",[509,1123,1124],{"class":523},"   ROLES",[509,1126,1127],{"class":523},"           AGE",[509,1129,1130],{"class":523},"   VERSION\n",[509,1132,1133,1136,1139,1142,1145],{"class":511,"line":555},[509,1134,1135],{"class":515},"kind-control-plane",[509,1137,1138],{"class":523},"   Ready",[509,1140,1141],{"class":523},"    control-plane",[509,1143,1144],{"class":523},"   21m",[509,1146,1147],{"class":523},"   v1.33.1\n",[509,1149,1150,1153,1156,1159,1162,1165,1168,1171],{"class":511,"line":573},[509,1151,1152],{"class":515},"kind-worker",[509,1154,1155],{"class":523},"          Ready",[509,1157,1158],{"class":527},"    \u003C",[509,1160,1161],{"class":523},"non",[509,1163,1164],{"class":569},"e",[509,1166,1167],{"class":527},">",[509,1169,1170],{"class":523},"          21m",[509,1172,1147],{"class":523},[509,1174,1175,1178,1181,1183,1185,1187,1189,1191],{"class":511,"line":677},[509,1176,1177],{"class":515},"kind-worker2",[509,1179,1180],{"class":523},"         Ready",[509,1182,1158],{"class":527},[509,1184,1161],{"class":523},[509,1186,1164],{"class":569},[509,1188,1167],{"class":527},[509,1190,1170],{"class":523},[509,1192,1147],{"class":523},[215,1194],{},[39,1196,1198],{"id":1197},"important-k8s-concepts","Important K8s Concepts",[228,1200,1202],{"id":1201},"_1-pods-and-deployments","1. Pods and Deployments",[51,1204,1205,1208,1211,1228,1412,1433,1500,1533,1563,1590,1615,1635,1653],{},[47,1206,1207],{},"A Pod is the smallest unit in Kubernetes. It runs one or more containers with shared storage and network resources.",[47,1209,1210],{},"A Deployment ensures that the desired number of pod replicas are running and manages rolling updates.",[47,1212,1213,1214],{},"We can list the running pods via following command\n",[500,1215,1217],{"className":502,"code":1216,"language":504,"meta":505,"style":505},"kubectl get pods\n",[92,1218,1219],{"__ignoreMap":505},[509,1220,1221,1223,1225],{"class":511,"line":512},[509,1222,718],{"class":515},[509,1224,1102],{"class":523},[509,1226,1227],{"class":523}," pods\n",[47,1229,1230,1231,1234,1235],{},"Let's create a our first pod using deployment file ",[92,1232,1233],{},"nginx-deployment.yaml",".\n",[500,1236,1238],{"className":913,"code":1237,"language":915,"meta":505,"style":505},"# nginx-deployment.yaml\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n",[92,1239,1240,1245,1254,1263,1270,1280,1287,1297,1304,1311,1321,1328,1335,1342,1352,1360,1368,1380,1391,1399],{"__ignoreMap":505},[509,1241,1242],{"class":511,"line":512},[509,1243,1244],{"class":778},"# nginx-deployment.yaml\n",[509,1246,1247,1249,1251],{"class":511,"line":555},[509,1248,933],{"class":922},[509,1250,925],{"class":569},[509,1252,1253],{"class":523},"apps\u002Fv1\n",[509,1255,1256,1258,1260],{"class":511,"line":573},[509,1257,481],{"class":922},[509,1259,925],{"class":569},[509,1261,1262],{"class":523},"Deployment\n",[509,1264,1265,1268],{"class":511,"line":677},[509,1266,1267],{"class":922},"metadata",[509,1269,946],{"class":569},[509,1271,1272,1275,1277],{"class":511,"line":823},[509,1273,1274],{"class":922},"  name",[509,1276,925],{"class":569},[509,1278,1279],{"class":523},"nginx-deployment\n",[509,1281,1282,1285],{"class":511,"line":848},[509,1283,1284],{"class":922},"spec",[509,1286,946],{"class":569},[509,1288,1289,1292,1294],{"class":511,"line":853},[509,1290,1291],{"class":922},"  replicas",[509,1293,925],{"class":569},[509,1295,1296],{"class":519},"2\n",[509,1298,1299,1302],{"class":511,"line":158},[509,1300,1301],{"class":922},"  selector",[509,1303,946],{"class":569},[509,1305,1306,1309],{"class":511,"line":1005},[509,1307,1308],{"class":922},"    matchLabels",[509,1310,946],{"class":569},[509,1312,1313,1316,1318],{"class":511,"line":1017},[509,1314,1315],{"class":922},"      app",[509,1317,925],{"class":569},[509,1319,1320],{"class":523},"nginx\n",[509,1322,1323,1326],{"class":511,"line":1030},[509,1324,1325],{"class":922},"  template",[509,1327,946],{"class":569},[509,1329,1330,1333],{"class":511,"line":1039},[509,1331,1332],{"class":922},"    metadata",[509,1334,946],{"class":569},[509,1336,1337,1340],{"class":511,"line":1051},[509,1338,1339],{"class":922},"      labels",[509,1341,946],{"class":569},[509,1343,1345,1348,1350],{"class":511,"line":1344},14,[509,1346,1347],{"class":922},"        app",[509,1349,925],{"class":569},[509,1351,1320],{"class":523},[509,1353,1355,1358],{"class":511,"line":1354},15,[509,1356,1357],{"class":922},"    spec",[509,1359,946],{"class":569},[509,1361,1363,1366],{"class":511,"line":1362},16,[509,1364,1365],{"class":922},"      containers",[509,1367,946],{"class":569},[509,1369,1371,1373,1376,1378],{"class":511,"line":1370},17,[509,1372,971],{"class":569},[509,1374,1375],{"class":922},"name",[509,1377,925],{"class":569},[509,1379,1320],{"class":523},[509,1381,1383,1386,1388],{"class":511,"line":1382},18,[509,1384,1385],{"class":922},"        image",[509,1387,925],{"class":569},[509,1389,1390],{"class":523},"nginx:latest\n",[509,1392,1394,1397],{"class":511,"line":1393},19,[509,1395,1396],{"class":922},"        ports",[509,1398,946],{"class":569},[509,1400,1402,1405,1407,1409],{"class":511,"line":1401},20,[509,1403,1404],{"class":569},"        - ",[509,1406,974],{"class":922},[509,1408,925],{"class":569},[509,1410,1411],{"class":519},"80\n",[47,1413,1414,1415],{},"Apply the deployment file\n",[500,1416,1418],{"className":502,"code":1417,"language":504,"meta":505,"style":505},"kubectl apply -f nginx-deployment.yaml\n",[92,1419,1420],{"__ignoreMap":505},[509,1421,1422,1424,1427,1430],{"class":511,"line":512},[509,1423,718],{"class":515},[509,1425,1426],{"class":523}," apply",[509,1428,1429],{"class":519}," -f",[509,1431,1432],{"class":523}," nginx-deployment.yaml\n",[47,1434,1435,1436,1448,1449],{},"Now list the running pods\n",[500,1437,1438],{"className":502,"code":1216,"language":504,"meta":505,"style":505},[92,1439,1440],{"__ignoreMap":505},[509,1441,1442,1444,1446],{"class":511,"line":512},[509,1443,718],{"class":515},[509,1445,1102],{"class":523},[509,1447,1227],{"class":523},"\nOutput:\n",[500,1450,1452],{"className":502,"code":1451,"language":504,"meta":505,"style":505},"NAME                              READY   STATUS    RESTARTS   AGE\nnginx-deployment-96b9d695-9h49b   1\u002F1     Running   0          20m\nnginx-deployment-96b9d695-rhd8x   1\u002F1     Running   0          20m\n",[92,1453,1454,1470,1487],{"__ignoreMap":505},[509,1455,1456,1458,1461,1464,1467],{"class":511,"line":512},[509,1457,1118],{"class":515},[509,1459,1460],{"class":523},"                              READY",[509,1462,1463],{"class":523},"   STATUS",[509,1465,1466],{"class":523},"    RESTARTS",[509,1468,1469],{"class":523},"   AGE\n",[509,1471,1472,1475,1478,1481,1484],{"class":511,"line":555},[509,1473,1474],{"class":515},"nginx-deployment-96b9d695-9h49b",[509,1476,1477],{"class":523},"   1\u002F1",[509,1479,1480],{"class":523},"     Running",[509,1482,1483],{"class":519},"   0",[509,1485,1486],{"class":523},"          20m\n",[509,1488,1489,1492,1494,1496,1498],{"class":511,"line":573},[509,1490,1491],{"class":515},"nginx-deployment-96b9d695-rhd8x",[509,1493,1477],{"class":523},[509,1495,1480],{"class":523},[509,1497,1483],{"class":519},[509,1499,1486],{"class":523},[47,1501,1502,1503],{},"We can exec into the pods using the below command to view the files of our container\n",[500,1504,1506],{"className":502,"code":1505,"language":504,"meta":505,"style":505},"kubectl exec -it \u003Cpod-name> -- sh\n",[92,1507,1508],{"__ignoreMap":505},[509,1509,1510,1512,1515,1518,1521,1524,1526,1528,1531],{"class":511,"line":512},[509,1511,718],{"class":515},[509,1513,1514],{"class":523}," exec",[509,1516,1517],{"class":519}," -it",[509,1519,1520],{"class":527}," \u003C",[509,1522,1523],{"class":523},"pod-nam",[509,1525,1164],{"class":569},[509,1527,1167],{"class":527},[509,1529,1530],{"class":519}," --",[509,1532,531],{"class":523},[47,1534,1535,1536,1539],{},"We can also view the logs of the container which process prints on ",[92,1537,1538],{},"stdout",[500,1540,1542],{"className":502,"code":1541,"language":504,"meta":505,"style":505},"kubectl logs -f \u003Ccontainer-name>\n",[92,1543,1544],{"__ignoreMap":505},[509,1545,1546,1548,1551,1553,1555,1558,1560],{"class":511,"line":512},[509,1547,718],{"class":515},[509,1549,1550],{"class":523}," logs",[509,1552,1429],{"class":519},[509,1554,1520],{"class":527},[509,1556,1557],{"class":523},"container-nam",[509,1559,1164],{"class":569},[509,1561,1562],{"class":527},">\n",[47,1564,1565,1566],{},"We can describe the pod to view each and every detail of it. if pod crashes or fails to start here we can debug the reason.\n",[500,1567,1569],{"className":502,"code":1568,"language":504,"meta":505,"style":505},"kubectl describe pod\u002F\u003Cpod-name>\n",[92,1570,1571],{"__ignoreMap":505},[509,1572,1573,1575,1578,1581,1584,1586,1588],{"class":511,"line":512},[509,1574,718],{"class":515},[509,1576,1577],{"class":523}," describe",[509,1579,1580],{"class":523}," pod\u002F",[509,1582,1583],{"class":527},"\u003C",[509,1585,1523],{"class":523},[509,1587,1164],{"class":569},[509,1589,1562],{"class":527},[47,1591,1592,1593],{},"To delete the pods if we run the below command.The existing pod will delete but new pod will be created by control manager using existing deployment resource which we applied previously.\n",[500,1594,1596],{"className":502,"code":1595,"language":504,"meta":505,"style":505},"kubectl delete pod\u002F\u003Cpod-name>\n",[92,1597,1598],{"__ignoreMap":505},[509,1599,1600,1602,1605,1607,1609,1611,1613],{"class":511,"line":512},[509,1601,718],{"class":515},[509,1603,1604],{"class":523}," delete",[509,1606,1580],{"class":523},[509,1608,1583],{"class":527},[509,1610,1523],{"class":523},[509,1612,1164],{"class":569},[509,1614,1562],{"class":527},[47,1616,1617,1618],{},"If we want to delete the pods permanently then we should delete the deployment and pod will be removed by k8s\n",[500,1619,1621],{"className":502,"code":1620,"language":504,"meta":505,"style":505},"kubectl delete deployment nginx-deployment\n",[92,1622,1623],{"__ignoreMap":505},[509,1624,1625,1627,1629,1632],{"class":511,"line":512},[509,1626,718],{"class":515},[509,1628,1604],{"class":523},[509,1630,1631],{"class":523}," deployment",[509,1633,1634],{"class":523}," nginx-deployment\n",[47,1636,1637,1638],{},"We can also delete K8s deployment resource using our existing deployment file\n",[500,1639,1641],{"className":502,"code":1640,"language":504,"meta":505,"style":505},"kubectl delete -f nginx-deployment.yaml\n",[92,1642,1643],{"__ignoreMap":505},[509,1644,1645,1647,1649,1651],{"class":511,"line":512},[509,1646,718],{"class":515},[509,1648,1604],{"class":523},[509,1650,1429],{"class":519},[509,1652,1432],{"class":523},[47,1654,1655,1656],{},"Wants to read more about pods checkout the ",[28,1657,1660],{"href":1658,"rel":1659},"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Fconcepts\u002Fworkloads\u002Fpods",[32],"K8s Pod documentation",[228,1662,1664],{"id":1663},"_2-services","2. Services",[51,1666,1667,1674,1677,1680,1683,1706,1709,1826,1845,1947,1956],{},[47,1668,1669,1670,1673],{},"Each pod in a cluster gets its own unique cluster-wide IP address. A pod has its own private network namespace which is shared by all of the containers within the pod. Processes running in different containers in the same pod can communicate with each other over ",[92,1671,1672],{},"localhost",".",[47,1675,1676],{},"The pod network (also called a cluster network) handles communication between pods. It ensures that all pods can communicate with all other pods, whether they are on the same node or on different nodes.",[47,1678,1679],{},"If we use a Deployment to run our app, that Deployment can create and destroy Pods dynamically. From one moment to the next, we don't know how many of those Pods are working and healthy. we might not even know what those healthy Pods are named.",[47,1681,1682],{},"The Service API lets us provide a stable (long lived) IP address or hostname for a service implemented by one or more backend pods, where the individual pods making up the service can change over time.",[47,1684,1685,1686],{},"A Service exposes pods to internal or external traffic. So we have several types of services:\n",[51,1687,1688,1694,1700],{},[47,1689,1690,1693],{},[13,1691,1692],{},"ClusterIP"," : This is a default service type. it exposes service on cluster's internal ip and makes it reachable only from within the cluster.",[47,1695,1696,1699],{},[13,1697,1698],{},"NodePort"," : Exposes service on each Node's IP at a static port(the NodePort). The default range of NodePort is 30000–32767 .",[47,1701,1702,1705],{},[13,1703,1704],{},"LoadBalancer"," : Exposes the Service externally using an external load balancer.",[47,1707,1708],{},"Let's access our nginx pod from outside of the cluster using NodePort service.",[47,1710,906,1711,1714,1715],{},[92,1712,1713],{},"nginx-service.yaml"," file and copy paste the below content.\n",[500,1716,1718],{"className":913,"code":1717,"language":915,"meta":505,"style":505},"# nginx-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  type: NodePort\n  selector:\n    app: nginx\n  ports:\n    - port: 80\n      targetPort: 80\n      nodePort: 30080\n",[92,1719,1720,1725,1734,1743,1749,1758,1764,1774,1780,1789,1796,1808,1817],{"__ignoreMap":505},[509,1721,1722],{"class":511,"line":512},[509,1723,1724],{"class":778},"# nginx-service.yaml\n",[509,1726,1727,1729,1731],{"class":511,"line":555},[509,1728,933],{"class":922},[509,1730,925],{"class":569},[509,1732,1733],{"class":523},"v1\n",[509,1735,1736,1738,1740],{"class":511,"line":573},[509,1737,481],{"class":922},[509,1739,925],{"class":569},[509,1741,1742],{"class":523},"Service\n",[509,1744,1745,1747],{"class":511,"line":677},[509,1746,1267],{"class":922},[509,1748,946],{"class":569},[509,1750,1751,1753,1755],{"class":511,"line":823},[509,1752,1274],{"class":922},[509,1754,925],{"class":569},[509,1756,1757],{"class":523},"nginx-service\n",[509,1759,1760,1762],{"class":511,"line":848},[509,1761,1284],{"class":922},[509,1763,946],{"class":569},[509,1765,1766,1769,1771],{"class":511,"line":853},[509,1767,1768],{"class":922},"  type",[509,1770,925],{"class":569},[509,1772,1773],{"class":523},"NodePort\n",[509,1775,1776,1778],{"class":511,"line":158},[509,1777,1301],{"class":922},[509,1779,946],{"class":569},[509,1781,1782,1785,1787],{"class":511,"line":1005},[509,1783,1784],{"class":922},"    app",[509,1786,925],{"class":569},[509,1788,1320],{"class":523},[509,1790,1791,1794],{"class":511,"line":1017},[509,1792,1793],{"class":922},"  ports",[509,1795,946],{"class":569},[509,1797,1798,1801,1804,1806],{"class":511,"line":1030},[509,1799,1800],{"class":569},"    - ",[509,1802,1803],{"class":922},"port",[509,1805,925],{"class":569},[509,1807,1411],{"class":519},[509,1809,1810,1813,1815],{"class":511,"line":1039},[509,1811,1812],{"class":922},"      targetPort",[509,1814,925],{"class":569},[509,1816,1411],{"class":519},[509,1818,1819,1822,1824],{"class":511,"line":1051},[509,1820,1821],{"class":922},"      nodePort",[509,1823,925],{"class":569},[509,1825,979],{"class":519},[47,1827,1828,1829],{},"Let's apply the service manifest using below command.\n",[500,1830,1832],{"className":502,"code":1831,"language":504,"meta":505,"style":505},"kubectl apply -f nginx-service.yaml\n",[92,1833,1834],{"__ignoreMap":505},[509,1835,1836,1838,1840,1842],{"class":511,"line":512},[509,1837,718],{"class":515},[509,1839,1426],{"class":523},[509,1841,1429],{"class":519},[509,1843,1844],{"class":523}," nginx-service.yaml\n",[47,1846,1847,1848,1448,1862],{},"To list the services run the below command\n",[500,1849,1851],{"className":502,"code":1850,"language":504,"meta":505,"style":505},"kubectl get services\n",[92,1852,1853],{"__ignoreMap":505},[509,1854,1855,1857,1859],{"class":511,"line":512},[509,1856,718],{"class":515},[509,1858,1102],{"class":523},[509,1860,1861],{"class":523}," services\n",[500,1863,1865],{"className":502,"code":1864,"language":504,"meta":505,"style":505},"NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE\nkubernetes      ClusterIP   10.96.0.1       \u003Cnone>        443\u002FTCP        49s\nnginx-service   NodePort    10.96.165.229   \u003Cnone>        80:30080\u002FTCP   8s\n",[92,1866,1867,1895,1921],{"__ignoreMap":505},[509,1868,1869,1871,1874,1877,1880,1883,1886,1889,1892],{"class":511,"line":512},[509,1870,1118],{"class":515},[509,1872,1873],{"class":523},"            TYPE",[509,1875,1876],{"class":523},"        CLUSTER-IP",[509,1878,1879],{"class":523},"      EXTERNAL-IP",[509,1881,1882],{"class":523},"   PORT",[509,1884,1885],{"class":569},"(",[509,1887,1888],{"class":515},"S",[509,1890,1891],{"class":569},")        ",[509,1893,1894],{"class":523},"AGE\n",[509,1896,1897,1900,1903,1906,1909,1911,1913,1915,1918],{"class":511,"line":555},[509,1898,1899],{"class":515},"kubernetes",[509,1901,1902],{"class":523},"      ClusterIP",[509,1904,1905],{"class":519},"   10.96.0.1",[509,1907,1908],{"class":527},"       \u003C",[509,1910,1161],{"class":523},[509,1912,1164],{"class":569},[509,1914,1167],{"class":527},[509,1916,1917],{"class":523},"        443\u002FTCP",[509,1919,1920],{"class":523},"        49s\n",[509,1922,1923,1926,1929,1932,1935,1937,1939,1941,1944],{"class":511,"line":573},[509,1924,1925],{"class":515},"nginx-service",[509,1927,1928],{"class":523},"   NodePort",[509,1930,1931],{"class":519},"    10.96.165.229",[509,1933,1934],{"class":527},"   \u003C",[509,1936,1161],{"class":523},[509,1938,1164],{"class":569},[509,1940,1167],{"class":527},[509,1942,1943],{"class":523},"        80:30080\u002FTCP",[509,1945,1946],{"class":523},"   8s\n",[47,1948,1949,1950,1955],{},"Now if we open the ",[28,1951,1954],{"href":1952,"rel":1953},"http:\u002F\u002Flocalhost:30080",[32],"localhost:30080"," in our browser. we will see a page served by our nginx pod.",[47,1957,1958,1959],{},"Wants to read more about k8s network model checkout the ",[28,1960,1963],{"href":1961,"rel":1962},"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Fconcepts\u002Fservices-networking",[32],"K8s services documentation",[228,1965,1967],{"id":1966},"_3-namespaces","3. Namespaces",[51,1969,1970,1973,1976,1979,2052,2055,2096,2126],{},[47,1971,1972],{},"Namespaces provide a mechanism for isolating groups of resources within a single cluster.",[47,1974,1975],{},"Names of resources need to be unique within a namespace, but not across namespaces.",[47,1977,1978],{},"Namespaces cannot be nested inside one another and each Kubernetes resource can only be in one namespace.",[47,1980,1981,1982,1996,1108,1999],{},"Kubernetes starts with four initial namespaces. We can list the current namespaces in a cluster using below command.",[500,1983,1985],{"className":502,"code":1984,"language":504,"meta":505,"style":505},"kubectl get namespaces\n",[92,1986,1987],{"__ignoreMap":505},[509,1988,1989,1991,1993],{"class":511,"line":512},[509,1990,718],{"class":515},[509,1992,1102],{"class":523},[509,1994,1995],{"class":523}," namespaces\n",[1997,1998],"br",{},[500,2000,2002],{"className":502,"code":2001,"language":504,"meta":505,"style":505},"NAME                 STATUS   AGE\ndefault              Active   78m\nkube-node-lease      Active   78m\nkube-public          Active   78m\nkube-system          Active   78m\n",[92,2003,2004,2012,2023,2033,2043],{"__ignoreMap":505},[509,2005,2006,2008,2010],{"class":511,"line":512},[509,2007,1118],{"class":515},[509,2009,1121],{"class":523},[509,2011,1469],{"class":523},[509,2013,2014,2017,2020],{"class":511,"line":555},[509,2015,2016],{"class":515},"default",[509,2018,2019],{"class":523},"              Active",[509,2021,2022],{"class":523},"   78m\n",[509,2024,2025,2028,2031],{"class":511,"line":573},[509,2026,2027],{"class":515},"kube-node-lease",[509,2029,2030],{"class":523},"      Active",[509,2032,2022],{"class":523},[509,2034,2035,2038,2041],{"class":511,"line":677},[509,2036,2037],{"class":515},"kube-public",[509,2039,2040],{"class":523},"          Active",[509,2042,2022],{"class":523},[509,2044,2045,2048,2050],{"class":511,"line":823},[509,2046,2047],{"class":515},"kube-system",[509,2049,2040],{"class":523},[509,2051,2022],{"class":523},[47,2053,2054],{},"Most Kubernetes resources (e.g. pods, services, replication controllers, and others) are in some namespaces. However namespace resources are not themselves in a namespace. And low-level resources, such as nodes and persistentVolumes, are not in any namespace.",[47,2056,2057,2058],{},"To see which Kubernetes resources are and aren't in a namespace:",[500,2059,2061],{"className":502,"code":2060,"language":504,"meta":505,"style":505},"# In a namespace\nkubectl api-resources --namespaced=true\n\n# Not in a namespace\nkubectl api-resources --namespaced=false\n",[92,2062,2063,2068,2078,2082,2087],{"__ignoreMap":505},[509,2064,2065],{"class":511,"line":512},[509,2066,2067],{"class":778},"# In a namespace\n",[509,2069,2070,2072,2075],{"class":511,"line":555},[509,2071,718],{"class":515},[509,2073,2074],{"class":523}," api-resources",[509,2076,2077],{"class":519}," --namespaced=true\n",[509,2079,2080],{"class":511,"line":573},[509,2081,815],{"emptyLinePlaceholder":814},[509,2083,2084],{"class":511,"line":677},[509,2085,2086],{"class":778},"# Not in a namespace\n",[509,2088,2089,2091,2093],{"class":511,"line":823},[509,2090,718],{"class":515},[509,2092,2074],{"class":523},[509,2094,2095],{"class":519}," --namespaced=false\n",[47,2097,2098,2099,2102,2103,2105,2106],{},"To see all the resources of a particular namespace flag every command with ",[92,2100,2101],{},"-n \u003Cnamespace>"," such as to view running pods in ",[92,2104,2047],{}," it would be.",[500,2107,2109],{"className":502,"code":2108,"language":504,"meta":505,"style":505},"kubectl get pods -n kube-system\n",[92,2110,2111],{"__ignoreMap":505},[509,2112,2113,2115,2117,2120,2123],{"class":511,"line":512},[509,2114,718],{"class":515},[509,2116,1102],{"class":523},[509,2118,2119],{"class":523}," pods",[509,2121,2122],{"class":519}," -n",[509,2124,2125],{"class":523}," kube-system\n",[47,2127,2128,2129],{},"Create a new namespace",[500,2130,2132],{"className":502,"code":2131,"language":504,"meta":505,"style":505},"kubectl create namespace mars\n",[92,2133,2134],{"__ignoreMap":505},[509,2135,2136,2138,2140,2143],{"class":511,"line":512},[509,2137,718],{"class":515},[509,2139,1076],{"class":523},[509,2141,2142],{"class":523}," namespace",[509,2144,2145],{"class":523}," mars\n",[228,2147,2149],{"id":2148},"_4-configmaps-and-secrets","4. Configmaps and Secrets",[51,2151,2152,2155,2158,2161,2178,2186,2189,2192,2209],{},[47,2153,2154],{},"A ConfigMap is an API object used to store non-confidential data in key-value pairs.",[47,2156,2157],{},"Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.",[47,2159,2160],{},"A ConfigMap allows you to decouple environment-specific configuration from our container images, so that our applications are easily portable.",[47,2162,2163,2164],{},"List all configmaps\n",[500,2165,2167],{"className":502,"code":2166,"language":504,"meta":505,"style":505},"kubectl get configmaps\n",[92,2168,2169],{"__ignoreMap":505},[509,2170,2171,2173,2175],{"class":511,"line":512},[509,2172,718],{"class":515},[509,2174,1102],{"class":523},[509,2176,2177],{"class":523}," configmaps\n",[47,2179,2180,2181],{},"To read more about configmaps and its usage please refere this ",[28,2182,2185],{"href":2183,"rel":2184},"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Fconcepts\u002Fconfiguration\u002Fconfigmap\u002F",[32],"k8s Configmap documentation",[47,2187,2188],{},"A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key.",[47,2190,2191],{},"Secrets are similar to ConfigMaps but are specifically intended to hold confidential data.",[47,2193,2194,2195],{},"List all secrets\n",[500,2196,2198],{"className":502,"code":2197,"language":504,"meta":505,"style":505},"kubectl get secrets\n",[92,2199,2200],{"__ignoreMap":505},[509,2201,2202,2204,2206],{"class":511,"line":512},[509,2203,718],{"class":515},[509,2205,1102],{"class":523},[509,2207,2208],{"class":523}," secrets\n",[47,2210,2211,2212],{},"To read more about secrets and its usage please refer this ",[28,2213,2216],{"href":2214,"rel":2215},"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Fconcepts\u002Fconfiguration\u002Fsecret",[32],"k8s secrets documentation",[39,2218,2220],{"id":2219},"demo-of-kind-cluster-and-nginx-application","Demo of kind cluster and nginx application",[2222,2223],"iframe",{"width":2224,"height":2225,"src":2226,"frameBorder":2227,"allowFullScreen":814},"100%",400,"https:\u002F\u002Fwww.youtube.com\u002Fembed\u002F4dMUHRe6KBw","0",[39,2229,2231],{"id":2230},"learning-resources","Learning Resources",[51,2233,2234,2241,2248,2255,2262,2268,2275,2282],{},[47,2235,2236],{},[28,2237,2240],{"href":2238,"rel":2239},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=s_o8dwzRlu4",[32],"Kubernetes Crash Course for Absolute Beginners",[47,2242,2243],{},[28,2244,2247],{"href":2245,"rel":2246},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=XuSQU5Grv1g&t=7676s",[32],"Kubernetes Crash Course: Learn the Basics and Build a Microservice Application",[47,2249,2250],{},[28,2251,2254],{"href":2252,"rel":2253},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=a-nWPre5QYI",[32],"What is Kubernetes? | Kubernetes Explained",[47,2256,2257],{},[28,2258,2261],{"href":2259,"rel":2260},"https:\u002F\u002Fkubernetes.io\u002Fdocs\u002Fhome\u002F",[32],"Kubernetes Documentation",[47,2263,2264],{},[28,2265,2267],{"href":2266},"\u002Fblogs\u002Fvirtualization_containers_and_role_of_docker_in_it","Virtualization , Containers and role of docker in it",[47,2269,2270],{},[28,2271,2274],{"href":2272,"rel":2273},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=MDsjINTL7Ek&t=945s",[32],"Below Kubernetes: Demystifying container runtimes",[47,2276,2277],{},[28,2278,2281],{"href":2279,"rel":2280},"https:\u002F\u002Fyoutube.com\u002Fplaylist?list=PLl4APkPHzsUUOkOv3i62UidrLmSB8DcGC&si=F7r1nq72VJawqAOW",[32],"Certified Kubernetes Administrator",[47,2283,2284],{},[28,2285,2288],{"href":2286,"rel":2287},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Mj04QOqAaJ8",[32],"Understanding Kubernetes Networking in 30 Minutes",[39,2290,2292],{"id":2291},"conclusion","Conclusion",[10,2294,2295],{},"Till now we have just covered tip of the iceburg. We have alot to learn about kubernetes but the topics we have covered are just enough to get you started using k8s in local setup and explore its architecture.",[10,2297,2298],{},"For production grade cluster setup and k8s distributions we will talk in another blog. So stay tuned.",[10,2300,2301],{},"Thanks for sticking around and practicing!",[10,2303,2304],{},"Until next time happy coding!",[2306,2307,2308],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .shJU0, html code.shiki .shJU0{--shiki-default:#22863A}",{"title":505,"searchDepth":555,"depth":555,"links":2310},[2311,2312,2316,2325,2332,2338,2339,2340],{"id":41,"depth":555,"text":42},{"id":219,"depth":555,"text":220,"children":2313},[2314,2315],{"id":230,"depth":573,"text":231},{"id":242,"depth":573,"text":243},{"id":262,"depth":555,"text":263,"children":2317},[2318,2319,2320,2321,2322,2323,2324],{"id":269,"depth":573,"text":270},{"id":293,"depth":573,"text":294},{"id":326,"depth":573,"text":327},{"id":356,"depth":573,"text":357},{"id":378,"depth":573,"text":379},{"id":409,"depth":573,"text":410},{"id":439,"depth":573,"text":440},{"id":474,"depth":555,"text":475,"children":2326},[2327,2329,2330,2331],{"id":488,"depth":573,"text":2328},"1. Docker",{"id":604,"depth":573,"text":605},{"id":724,"depth":573,"text":725},{"id":763,"depth":573,"text":764},{"id":1197,"depth":555,"text":1198,"children":2333},[2334,2335,2336,2337],{"id":1201,"depth":573,"text":1202},{"id":1663,"depth":573,"text":1664},{"id":1966,"depth":573,"text":1967},{"id":2148,"depth":573,"text":2149},{"id":2219,"depth":555,"text":2220},{"id":2230,"depth":555,"text":2231},{"id":2291,"depth":555,"text":2292},"2025-06-07","A developer-friendly introduction to Kubernetes — pods, deployments, services, and namespaces explained with hands-on examples for getting started with K8s.",false,"md",{},"\u002Fblogs\u002Fkubernetes",{"title":5,"description":2342},"blogs\u002Fkubernetes\u002Findex",[2350,2351,595,2352,1899,2353,2354],"programming language","computer science","containers","programming","software","6VemZpWvfRlCaF5WWnDY736MZXpTZQDZZk4wgdffDls",1782753863546]