{"id":798,"date":"2019-02-26T17:08:18","date_gmt":"2019-02-26T14:08:18","guid":{"rendered":"https:\/\/artem.services\/?p=795"},"modified":"2019-02-26T17:19:02","modified_gmt":"2019-02-26T14:19:02","slug":"kubernetes-ingress-nginx-replicas-d0-b8-nodeselector","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=798&lang=en","title":{"rendered":"Kubernetes &#8212; Ingress Nginx: Replicas and Nodeselector"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-99 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform.png\" alt=\"\" width=\"1210\" height=\"418\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform.png 1210w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform-300x104.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform-768x265.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform-1024x354.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/terraform-954x330.png 954w\" sizes=\"(max-width: 1210px) 100vw, 1210px\" \/><\/p>\n<h4>Replicas<\/h4>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">Let&#8217;s look at the <\/span><\/span> <strong>name<\/strong> and <strong>namespace<\/strong> of <strong>Ingress<\/strong>&#39;\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get deployments.apps --all-namespaces\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">Edit our <strong>Ingress<\/strong>:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl edit deployments.apps nginx-ingress-controller -n ingress-nginx\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">And we find the string:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nreplicas: 1\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">Set <strong>2<\/strong> replicas:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nreplicas: 2\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">You can save changes and watch the number of <strong>Ingress<\/strong> Pods.<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<h4>nodeSelector<\/h4>\n<p><span class=\"tlid-translation translation\"><span title=\"\">We explicitly indicate on which nodes the <strong>Ingress<\/strong> should be run.<\/span> <span class=\"\" title=\"\">Let&#8217;s see the current label:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get nodes --show-labels\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">Set the <strong>label<\/strong>:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl label node NODE_NAME node-role.kubernetes.io\/ingress=true\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">Edit <strong>Ingress<\/strong> again:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl edit deployments.apps nginx-ingress-controller -n ingress-nginx\r\n<\/pre>\n<p><span class=\"tlid-translation translation\"><span class=\"\" title=\"\">We are interested in <strong>Deployment<\/strong>, namely the block &quot;<strong>spec<\/strong>&quot; -&gt; &quot;<strong>containers<\/strong>&quot;.<\/span> <span class=\"\" title=\"\">Add our &quot;<strong>nodeSelector<\/strong>&quot; block to it:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n    spec:\r\n      containers:\r\n      nodeSelector:\r\n        node-role.kubernetes.io\/ingress: &quot;true&quot;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Replicas Let&#8217;s look at the name and namespace of Ingress&#39;\u0430: Edit our Ingress: And we find the string: Set 2 replicas: You can save changes and watch the number of Ingress Pods. &nbsp; nodeSelector We explicitly indicate on which nodes the Ingress should be run. Let&#8217;s see the current label: Set the label: Edit Ingress &hellip; <a href=\"https:\/\/artem.services\/?p=798&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Kubernetes &#8212; Ingress Nginx: Replicas and Nodeselector&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[559],"tags":[561,547,563,549,551],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/798"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=798"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions"}],"predecessor-version":[{"id":801,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions\/801"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}