{"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\/nl\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","title":{"rendered":"Een eenvoudige en veilige manier om canary-deployments te automatiseren met Helm","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Een eenvoudige en veilige manier om canary-deployments te automatiseren met Helm\" src=\"\/wp-content\/uploads\/2019\/09\/255c7f20fb17c079b8a59ced9c092088.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nCanary deployment is a very effective way to test new code on a subset of users. It significantly reduces the traffic load that could cause issues during deployment, as it occurs only within a specific subgroup. This note is dedicated to how to organize such a deployment using Kubernetes and deployment automation. <i>It is assumed that you know something about Helm and Kubernetes resources.<\/i>. <br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\n<img decoding=\"async\" alt=\"Een eenvoudige en veilige manier om canary-deployments te automatiseren met Helm\" src=\"\/wp-content\/uploads\/2019\/09\/e8501460ddbfe797d036a399680032c1.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nA simple canary deployment in Kubernetes includes two key resources: the service itself and the deployment tool. The canary deployment works through one service, which interacts with two different resources serving the update traffic. One of these resources will work with the \"canary\" version, while the other will handle the stable version. In this situation, we can regulate the number of canary versions to reduce the amount of traffic that needs servicing. If, for example, you prefer to use YAML, it will look like this in Kubernetes: <\/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 # Selector will route traffic to both deployments.<\/code><\/pre>\n<p>\nThis option can even be better visualized using kubectl, while in <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/cluster-administration\/manage-deployment\/#canary-deployments\">the Kubernetes documentation<\/a><\/noindex> there is even a complete tutorial on this scenario. But the main question of this post is how we plan to automate this process using Helm. <\/p>\n<h3>Automating Canary Deployment <\/h3>\n<p>\nFirst of all, we need a Helm chart map that already contains the resources we discussed above. It should look something like this:<\/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>\nThe foundation of the Helm concept is multi-version release management. The stable version is our main stable branch of the project code. But with Helm, we can deploy a canary release with our experimental code. The key is to maintain traffic exchange between the stable version and the canary release. We will manage all this using a special selector:<\/p>\n<pre><code class=\"xml\">selector:\n  app.kubernetes.io\\\/name: myapp<\/code><\/pre>\n<p>\nOnze zowel \"canary\" als stable deployment resources geven deze tag aan de modules. Als alles goed is ingesteld, zien we tijdens de uitrol van de canary-versie van onze Helm chart, dat het verkeer naar de pas uitgerolde modules wordt geleid. De stabiele versie van dit commando ziet er zo uit: <\/p>\n<pre><code class=\"xml\">helm upgrade\n  --install myapp \n  --namespace default \n  --set app.name=myapp       # Gaat naar app.kubernetes.io\/name\n  --set app.version=v1       # Gaat naar app.kubernetes.io\/version\n  --set image.tag=stable \n  --set replicaCount=5<\/code><\/pre>\n<p>\nLaten we nu onze canary release controleren. Om de canary versie uit te rollen, moeten we aan twee dingen denken. De naam van de release moet anders zijn, zodat we geen updates op de huidige stable versie toepassen. De versie en tag moeten ook verschillen, zodat we andere code kunnen uitrollen en de verschillen in de resource labels kunnen vaststellen. <\/p>\n<pre><code class=\"xml\">helm upgrade\n  --install myapp-canary \n  --namespace default \n  --set app.name=myapp       # Gaat naar app.kubernetes.io\/name\n  --set app.version=v2       # Gaat naar app.kubernetes.io\/version\n  --set image.tag=canary \n  --set replicaCount=1<\/code><\/pre>\n<p>\nDat is alles! Als je de service pingt, kun je zien dat de canary update het verkeer slechts een deel van de tijd omleidt. <\/p>\n<p>\nAls je op zoek bent naar deployment automation tools die de beschreven logica bevatten, kijk dan eens naar <noindex><a rel=\"nofollow\" href=\"https:\/\/deliverybot.github.io\/\">Deliverybot<\/a><\/noindex> en op <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deliverybot\/helm\">Helm automation tools op GitHub<\/a><\/noindex>. De Helm charts die worden gebruikt voor het implementeren van de hierboven beschreven methode bevinden zich op Github, <noindex><a rel=\"nofollow\" href=\"http:\/\/github.com\/deliverybot\/helm\/charts\">hier<\/a><\/noindex>. Dit was in feite een theoretisch overzicht van hoe je canary deployment automatisering in de praktijk kunt implementeren, met specifieke concepten en voorbeelden.<br \/>\n<br \/>Bron: <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\/nl\/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=\"nl_NL\" \/>\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\/nl\/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\udd47Eenvoudige en veilige manier om canary deployments te automatiseren met Helm | ProHoster","description":"Canary.","canonical_url":"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/prostoj-i-bezopasnyj-sposob-avtomatizatsii-kanareechnyh-deploev-s-pomoshhyu-helm","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"nl_NL","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\/nl\/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\/nl\/wp-json\/wp\/v2\/posts\/38312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/comments?post=38312"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/38312\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/media\/28760"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/media?parent=38312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/categories?post=38312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/tags?post=38312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}