{"id":38312,"date":"2019-10-31T22:22:55","date_gmt":"2019-10-31T19:22:55","guid":{"rendered":"https:\/\/prohoster.info\/blog\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm\/"},"modified":"2019-10-31T22:22:55","modified_gmt":"2019-10-31T19:22:55","slug":"prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","status":"publish","type":"post","link":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","title":{"rendered":"Uma maneira simples e segura de automatizar implanta\u00e7\u00f5es can\u00e1rias usando Helm","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Uma maneira simples e segura de automatizar implanta\u00e7\u00f5es can\u00e1rias usando Helm\" src=\"\/wp-content\/uploads\/2019\/09\/255c7f20fb17c079b8a59ced9c092088.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nA implanta\u00e7\u00e3o can\u00e1ria \u00e9 uma maneira muito eficaz de testar novo c\u00f3digo em um subconjunto de usu\u00e1rios. Ela reduz significativamente a carga de tr\u00e1fego, que poderia causar problemas durante a implanta\u00e7\u00e3o, j\u00e1 que ocorre apenas dentro de um grupo espec\u00edfico. Esta nota se dedica a como organizar tal implanta\u00e7\u00e3o usando ferramentas do Kubernetes e automa\u00e7\u00e3o de implanta\u00e7\u00f5es. <i>Suponha que voc\u00ea saiba um pouco sobre Helm e recursos do Kubernetes<\/i>. <br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\n<img decoding=\"async\" alt=\"Uma maneira simples e segura de automatizar implanta\u00e7\u00f5es can\u00e1rias usando Helm\" src=\"\/wp-content\/uploads\/2019\/09\/e8501460ddbfe797d036a399680032c1.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nUma implanta\u00e7\u00e3o can\u00e1ria simples no Kubernetes envolve dois recursos principais: o pr\u00f3prio servi\u00e7o e a ferramenta de implanta\u00e7\u00e3o. A implanta\u00e7\u00e3o can\u00e1ria funciona atrav\u00e9s de um servi\u00e7o que interage com dois recursos diferentes, gerenciando o tr\u00e1fego de atualiza\u00e7\u00e3o. Um desses recursos ir\u00e1 operar com a vers\u00e3o 'can\u00e1ria', enquanto o outro com a vers\u00e3o est\u00e1vel. Nesse cen\u00e1rio, podemos ajustar a quantidade de vers\u00f5es can\u00e1rias para reduzir o tr\u00e1fego necess\u00e1rio. Por exemplo, se voc\u00ea preferir usar Yaml, isso seria configurado no Kubernetes da seguinte forma: <\/p>\n<pre><code class=\"xml\">kind: Deployment\nmetadata:\n  name: app-canary\n  labels:\n    app: app\nspec:\n  replicas: 1\n  ...\n    image: myapp:canary\n---\nkind: Deployment\nmetadata:\n  name: app\n  labels:\n    app: app\nspec:\n  replicas: 5\n  ...\n    image: myapp:stable\n---\nkind: Service\nselector:\n  app: app # O seletor vai direcionar o tr\u00e1fego para ambas as implanta\u00e7\u00f5es.<\/code><\/pre>\n<p>\nUma maneira ainda mais simples de visualizar isso \u00e9 usando kubectl, e na <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/cluster-administration\/manage-deployment\/#canary-deployments\">documenta\u00e7\u00e3o do Kubernetes<\/a><\/noindex> h\u00e1 at\u00e9 um tutorial completo sobre esse cen\u00e1rio. Mas a quest\u00e3o principal deste post \u00e9 como vamos automatizar esse processo usando Helm. <\/p>\n<h3>Automa\u00e7\u00e3o da implanta\u00e7\u00e3o can\u00e1ria <\/h3>\n<p>\nPrimeiro, precisaremos de um mapa dos gr\u00e1ficos do Helm, que j\u00e1 inclui os recursos discutidos acima. Ele deve ter a seguinte apar\u00eancia:<\/p>\n<pre><code class=\"xml\">~\\\/charts\\\/app\n\u251c\u2500\u2500 Chart.yaml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 templates\n\u2502   \u251c\u2500\u2500 NOTES.txt\n\u2502   \u251c\u2500\u2500 _helpers.tpl\n\u2502   \u251c\u2500\u2500 deployment.yaml\n\u2502   \u2514\u2500\u2500 service.yaml\n\u2514\u2500\u2500 values.yaml<\/code><\/pre>\n<p>\nA base do conceito do Helm \u00e9 a gest\u00e3o de vers\u00f5es m\u00faltiplas de releases. A vers\u00e3o est\u00e1vel \u00e9 nosso ramo principal de c\u00f3digo est\u00e1vel do projeto. Mas, com o Helm, podemos implantar uma vers\u00e3o can\u00e1ria com nosso c\u00f3digo experimental. O importante \u00e9 manter a troca de tr\u00e1fego entre a vers\u00e3o est\u00e1vel e a vers\u00e3o can\u00e1ria. Vamos gerenciar tudo isso com um seletor especial:<\/p>\n<pre><code class=\"xml\">selector:\n  app.kubernetes.io\\\/name: myapp<\/code><\/pre>\n<p>\nNossos recursos de deployment, tanto os 'can\u00e1rio' quanto os est\u00e1veis, indicar\u00e3o esse r\u00f3tulo nos m\u00f3dulos. Se tudo estiver configurado corretamente, durante o deployment da vers\u00e3o can\u00e1ria do nosso gr\u00e1fico Helm, veremos que o tr\u00e1fego ser\u00e1 direcionado para os m\u00f3dulos rec\u00e9m-implantados. A vers\u00e3o est\u00e1vel deste comando ser\u00e1 assim: <\/p>\n<pre><code class=\"xml\">helm upgrade\n  --install myapp \n  --namespace default \n  --set app.name=myapp       # Vai para app.kubernetes.io\/name\n  --set app.version=v1       # Vai para app.kubernetes.io\/version\n  --set image.tag=stable \n  --set replicaCount=5<\/code><\/pre>\n<p>\nAgora vamos verificar nosso release can\u00e1rio. Para fazer o deployment da vers\u00e3o can\u00e1ria, precisamos ter em mente duas coisas. O nome do release deve ser diferente, para que n\u00e3o fa\u00e7amos uma atualiza\u00e7\u00e3o na vers\u00e3o est\u00e1vel atual. A vers\u00e3o e a tag tamb\u00e9m devem ser diferentes, para que possamos implantar um c\u00f3digo distinto e identificar as diferen\u00e7as pelos r\u00f3tulos dos recursos. <\/p>\n<pre><code class=\"xml\">helm upgrade\n  --install myapp-canary \n  --namespace default \n  --set app.name=myapp       # Vai para app.kubernetes.io\/name\n  --set app.version=v2       # Vai para app.kubernetes.io\/version\n  --set image.tag=canary \n  --set replicaCount=1<\/code><\/pre>\n<p>\n\u00c9 isso! Se voc\u00ea pingar o servi\u00e7o, ver\u00e1 que a atualiza\u00e7\u00e3o can\u00e1ria direciona o tr\u00e1fego apenas parte do tempo. <\/p>\n<p>\nSe voc\u00ea est\u00e1 procurando ferramentas de automa\u00e7\u00e3o de deployment que incluam a l\u00f3gica descrita, considere <noindex><a rel=\"nofollow\" href=\"https:\/\/deliverybot.github.io\/\">Deliverybot<\/a><\/noindex> e no <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deliverybot\/helm\">ferramentas de automa\u00e7\u00e3o Helm no GitHub<\/a><\/noindex>. Os gr\u00e1ficos Helm usados para implementar o m\u00e9todo descrito acima est\u00e3o no Github, <noindex><a rel=\"nofollow\" href=\"http:\/\/github.com\/deliverybot\/helm\/charts\">aqui<\/a><\/noindex>. Na verdade, este foi um panorama te\u00f3rico de como implementar a automa\u00e7\u00e3o do deployment de vers\u00f5es can\u00e1rias na pr\u00e1tica, com conceitos e exemplos concretos.<br \/>\n<br \/>Fonte: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/itsumma\/blog\/468013\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0439 \u0434\u0435\u043f\u043b\u043e\u0439 \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041e\u043d \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a-\u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u044b. \u042d\u0442\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u0435\u043f\u043b\u043e\u0439 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Kubernetes \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0435\u043f\u043b\u043e\u044f. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u043a\u043e\u0435-\u0447\u0442\u043e \u0437\u043d\u0430\u0435\u0442\u0435 \u043e Helm \u0438 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":28760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-38312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0439.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"pt_PT\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0445 \u0434\u0435\u043f\u043b\u043e\u0435\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Helm | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0439.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:22:55+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:22:55+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Uma maneira simples e segura de automatizar deployments can\u00e1rios com Helm | ProHoster","description":"Can\u00e1rio.","canonical_url":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"pt_PT","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0445 \u0434\u0435\u043f\u043b\u043e\u0435\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Helm | ProHoster","og:description":"\u041a\u0430\u043d\u0430\u0440\u0435\u0435\u0447\u043d\u044b\u0439.","og:url":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:22:55+00:00","article:modified_time":"2019-10-31T19:22:55+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"38312","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-23 21:27:22","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:11:24","updated":"2026-01-23 21:27:22","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/38312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/comments?post=38312"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/38312\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media\/28760"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media?parent=38312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/categories?post=38312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/tags?post=38312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}