{"id":39337,"date":"2016-08-30T14:43:29","date_gmt":"2016-08-30T09:13:29","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=39337"},"modified":"2024-01-02T17:46:16","modified_gmt":"2024-01-02T12:16:16","slug":"getting-started-with-kubernetes","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/getting-started-with-kubernetes\/","title":{"rendered":"Getting started with Kubernetes"},"content":{"rendered":"<p><strong>Kubernetes <\/strong>is an open source\u00a0orchestration tool for application containers developed by Google. It packages all of the necessary tools &#8211; orchestration, service discovery and load balancing in one place. <a href=\"http:\/\/www.tothenew.com\/blog\/setup-kubernetes-cluster-on-aws-ec2\/\">Kubernetes<\/a> is portable which means it can be deployed on public, private, hybrid along with multiple cloud\u00a0platform providers. It is developed to <a title=\"docker devops\" href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">manage Docker<\/a> containers.<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-ttn-blog\/uploads\/2024\/01\/kube7-logo.png\" alt=\"Image result for kubernetes\" \/><\/p>\n<p>Kubernetes is a full-fledged container orchestration system that includes a scheduler, health checks, rolling upgrades, autoscaling, etc. whereas another popular orchestration tool Docker Swarm, is mainly about providing a cluster-wide view of a single Docker engine.<\/p>\n<p>With Kubernetes:<br \/>\na) Applications can be deployed quickly and with zero downtime<br \/>\nb) Applications can be scaled on the fly<br \/>\nc) Applications can be self-healed<\/p>\n<h2>Terms used in Kubernetes<\/h2>\n<p><strong>Master<\/strong> is\u00a0a node that manages the Kubernetes cluster, including assigning pods to minions, etc.<br \/>\nMinion is\u00a0an agent node that runs the pods assigned by the master node.<br \/>\n<strong>Pod\u00a0<\/strong>is a group of one or more containers for an application which runs on minion nodes.<br \/>\n<strong>Deployment\u00a0<\/strong>is a controller which manages the pods. It ensures the desired number of pods are always running.<br \/>\n<b>Replica set<\/b> is\u00a0the desired number of pods which needs to be running always.<br \/>\n<strong>Service <\/strong> is an endpoint that exposes the ports to the outside world and mapped the port to the container port (target port)<br \/>\n<strong>kubectl <\/strong> is an command line tool used for creating\/deleting\/retrieving\u00a0 deployments, pods, services, hpa (horizontal pod autoscaling), etc., drain, . basically a utility to run commands on the kubernetes cluster:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39803\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/commands.png\" alt=\"commands\" width=\"1052\" height=\"533\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/commands.png 1052w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/commands-300x151.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/commands-1024x518.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/commands-624x316.png 624w\" sizes=\"(max-width: 1052px) 100vw, 1052px\" \/><\/p>\n<p><strong>Useful commands<\/strong><\/p>\n<p><strong>kubectl describe nodes<\/strong>: This command provides the list of the minion nodes in the cluster, their status and the age (uptime):<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39785\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes.png\" alt=\"nodes\" width=\"412\" height=\"216\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes.png 412w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes-300x157.png 300w\" sizes=\"(max-width: 412px) 100vw, 412px\" \/><\/p>\n<p><strong>kubectl describe nodes &lt;node name&gt;<\/strong> : This command provides some extra information about the node including Name, labels, resource limits. If the node runs out of capacity, disk space full, it will provide all those details:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39786\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes1.png\" alt=\"nodes1\" width=\"1298\" height=\"521\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes1.png 1298w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes1-300x120.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes1-1024x411.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/nodes1-624x250.png 624w\" sizes=\"(max-width: 1298px) 100vw, 1298px\" \/><\/p>\n<p><strong>kubectl get deployment &lt;options&gt;:<\/strong> This command provides the list of deployments, its age, desired and current capacity of the pods, number of available pods:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39791\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/deployment.png\" alt=\"deployment\" width=\"550\" height=\"73\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/deployment.png 550w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/deployment-300x39.png 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/p>\n<p><strong>kubectl get pods or kubectl get pods -o wide:<\/strong> This command provides the details about the pods including status of the pods, actual and desired capacity of the containers in the READY column, node on which the pod is running and the age of the pods, IP of the pods and how many times a pod has been restarted:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39792\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/pods.png\" alt=\"pods\" width=\"936\" height=\"68\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/pods.png 936w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/pods-300x21.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/pods-624x45.png 624w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/p>\n<p><strong>kubectl get svc or kubectl get svc -o wide:<\/strong> This command provides the name of the service, cluster IP of the service, external IP\/endpoint, ports it has been mapped to (inbound port) and its age:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39793\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/svc.png\" alt=\"svc\" width=\"1019\" height=\"86\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/svc.png 1019w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/svc-300x25.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/svc-624x52.png 624w\" sizes=\"(max-width: 1019px) 100vw, 1019px\" \/><\/p>\n<p>Hope this helps you in understanding the basics of Kubernetes.<br \/>\nIn my upcoming blogs, I will be\u00a0explaining how to deploy applications without\u00a0downtime, rolling update strategy, assigning a pod to multiple nodes,\u00a0 readiness probe, multiple containers in a pod etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes is an open source\u00a0orchestration tool for application containers developed by Google. It packages all of the necessary tools &#8211; orchestration, service discovery and load balancing in one place. Kubernetes is portable which means it can be deployed on public, private, hybrid along with multiple cloud\u00a0platform providers. It is developed to manage Docker containers. Kubernetes [&hellip;]<\/p>\n","protected":false},"author":970,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":5},"categories":[2348,1],"tags":[3866,1892,1883,3969,3968,3967,3964,3965,3966,3972,3971,3970],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/39337"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/970"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=39337"}],"version-history":[{"count":1,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/39337\/revisions"}],"predecessor-version":[{"id":59837,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/39337\/revisions\/59837"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=39337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=39337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=39337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}