{"id":2700,"date":"2020-04-22T01:56:44","date_gmt":"2020-04-22T01:56:44","guid":{"rendered":"https:\/\/wiki.thomasandsofia.com\/?p=2700"},"modified":"2020-04-22T11:50:06","modified_gmt":"2020-04-22T11:50:06","slug":"9-container-orchestration","status":"publish","type":"post","link":"https:\/\/wiki.thomasandsofia.com\/?p=2700","title":{"rendered":"9: Container Orchestration"},"content":{"rendered":"<p><a href=\"\/8-docker-on-mac-and-windows\/\">&lt; 8 Docker on Windows and Mac<\/a> | <a href=\"\/10-conclusion\/\">10 Conclusion &gt;<\/a><\/p>\n<h1>44: Container Orchestration<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/15828644#content\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/15828644#content<\/a><\/p>\n<ul>\n<li>You can only deploy a single container with the docker run command.<\/li>\n<li>What if the container fails? You&#8217;ll need to manually relaunch the container.<\/li>\n<li>What if the load increases? You&#8217;ll need to manually launch additional containers.<\/li>\n<li>What if the Host fails?\u00a0 Who will sit and monitor that?<\/li>\n<\/ul>\n<p>This is what Orchestration solves<\/p>\n<h2>Options for Orchestration<\/h2>\n<ul>\n<li>Docker swarm\n<ul>\n<li>Easy to setup<\/li>\n<li>Lacks advanced features<\/li>\n<\/ul>\n<\/li>\n<li>kubernetes\n<ul>\n<li>Slightly difficult to set up<\/li>\n<li>Provides a lot of options to setup and customize.<\/li>\n<\/ul>\n<\/li>\n<li>MESOS\n<ul>\n<li>Difficult to configure<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1>45. Docker Swarm<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/7894030#content\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/7894030#content<\/a><\/p>\n<p>Docker swarm allows you to arrange your containers into clusters<\/p>\n<ul>\n<li>Manage across hosts<\/li>\n<li>Scalability<\/li>\n<li>High Availability<\/li>\n<\/ul>\n<h2>Swarm Setup<\/h2>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/docker-swarm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2704\" src=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/docker-swarm.png\" alt=\"\" width=\"653\" height=\"437\" srcset=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/docker-swarm.png 653w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/docker-swarm-300x201.png 300w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/docker-swarm-150x100.png 150w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><\/a><\/p>\n<h3>Create the Swarm manager using<\/h3>\n<pre>docker swarm init<\/pre>\n<h3>Join the worker nodes<\/h3>\n<pre>docker swarm join --tocken &lt;token&gt;<\/pre>\n<h2>Docker service<\/h2>\n<p>A Docker Services are one or more instances of a single application that run across the nodes in a cluster.<\/p>\n<h3>On Master<\/h3>\n<pre>docker run my-web-server\r\ndocker service create --replicas=3 &lt;-e&gt; &lt;-p&gt; &lt;--network&gt; my-web-server<\/pre>\n<p>&nbsp;<\/p>\n<h1>46: Kubernetes Introduction<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/15828702#content\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/15828702#content<\/a><\/p>\n<p>Kubernetes actually requires it own courses. (5?)<\/p>\n<pre>kubectl scale --replicas=2000 my-web-server\r\nkubectl run --replicas=1000 my-web-server<\/pre>\n<h3>Rolling upgrades \/ downgrades<\/h3>\n<pre>kubectl rolling-update my-web-serve --image=web-server:2\r\nkubectl rolling-update mys-web-server --rollback<\/pre>\n<h4>Testing upgrades<\/h4>\n<p>Possible to test upgrades by only rolling out the upgrade to a percentage of instances in your cluster.<\/p>\n<h2>Open Architecture<\/h2>\n<ul>\n<li>Almost every vendor you can think of provide plugins for Kubernetes.\n<ul>\n<li>Storage<\/li>\n<li>Networking<\/li>\n<\/ul>\n<\/li>\n<li>Available on all popular Cloud hosts<\/li>\n<li>Works with various containerization systems\n<ul>\n<li>Docker<\/li>\n<li>rkt (Rocket)<\/li>\n<li>Others<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Understanding Kubernetes Architecture<\/h2>\n<ul>\n<li>A Kubernetes cluster consists of a set of nodes<\/li>\n<li>A Node\n<ul>\n<li>Is a physical or virtual machine on which the Kubernetes tools are installed<\/li>\n<li>Is a worker machine where containers will be launched.<\/li>\n<li>For HA, you need to have more than 1 node.<\/li>\n<\/ul>\n<\/li>\n<li>A Cluster is a set of Nodes grouped together.<\/li>\n<li>A Master\n<ul>\n<li>Is a Node with Kubernetes Control Plane Components installed.<\/li>\n<li>Watches over the Nodes and is responsible for the orchestration of the containers.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Components<\/h3>\n<ul>\n<li>API Server\n<ul>\n<li>Acts as the front end for Kubenetes<\/li>\n<li>Management devices, CLIs, all communicate with Kubernetes via the API<\/li>\n<\/ul>\n<\/li>\n<li>ectd\n<ul>\n<li>Key: Value store<\/li>\n<li>Stores all data used to manage the cluster<\/li>\n<li>Stores all information about all nodes and masters in a distributed manner.<\/li>\n<li>Responsible for implementing logs to ensure there are no conflicts between the masters<\/li>\n<\/ul>\n<\/li>\n<li>scheduler\n<ul>\n<li>Distributes the work across multiple nodes<\/li>\n<li>Looks for newly created containers and assigns them to nodes<\/li>\n<\/ul>\n<\/li>\n<li>Controller\n<ul>\n<li>Brains behind orchestration<\/li>\n<li>Responsible for noticing and reacting when Nodes, Containers or Endpoints go down.<\/li>\n<li>Controllers make decisions to bring up new containers in such instances.<\/li>\n<\/ul>\n<\/li>\n<li>Container Runtime\n<ul>\n<li>The underlying software used to run containers.\n<ul>\n<li>Docker, etc.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>kubelet\n<ul>\n<li>Agent that runs on each node in the cluster<\/li>\n<li>Makes sure the containers are running on the nodes as expected<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>kubectl (kube control tool)<\/h2>\n<ul>\n<li>Kubernetes CLI used to\n<ul>\n<li>Deploy and manage applications on a cluster<\/li>\n<li>Get cluster related information<\/li>\n<li>Get status of nodes<\/li>\n<li>etc<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>kubectl run<\/h3>\n<p>Run an application on the cluster<\/p>\n<pre>kubectl run hello-minikube<\/pre>\n<h3>kubectl cluster-info<\/h3>\n<p>Get information about the cluster<\/p>\n<pre>kubectl cluster-info<\/pre>\n<h3>kubectl get nodes<\/h3>\n<p>List all nodes in the cluster<\/p>\n<pre>kubectl get nodes<\/pre>\n<h2>Kubernetes Deployment Example<\/h2>\n<p>To run hundreds of applications across all nodes in the cluster, run a single command:<\/p>\n<pre>kubectl run my-web-app --image=my-web-app --replicas=1000<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt; 8 Docker on Windows and Mac | 10 Conclusion &gt; 44: Container Orchestration https:\/\/www.udemy.com\/course\/learn-docker\/learn\/lecture\/15828644#content You can only deploy a single container with the docker run command. What if the container fails? You&#8217;ll need to manually relaunch the container. What if the load increases? You&#8217;ll need to manually launch additional containers. What if the Host ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/?p=2700\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-2700","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2700"}],"version-history":[{"count":4,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2700\/revisions"}],"predecessor-version":[{"id":2710,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2700\/revisions\/2710"}],"wp:attachment":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}