{"id":4092,"date":"2025-07-03T18:51:36","date_gmt":"2025-07-03T15:51:36","guid":{"rendered":"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/blue-green-deployment\/"},"modified":"2025-07-03T18:56:00","modified_gmt":"2025-07-03T15:56:00","slug":"blue-green-deployment","status":"publish","type":"docs","link":"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/blue-green-deployment\/","title":{"rendered":"Blue-Green Deployment (\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439)"},"content":{"rendered":"\n<p><strong>Blue-Green Deployment<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0432\u044b\u043a\u0430\u0442\u0430 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b: <strong>blue<\/strong> (\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f) \u0438 <strong>green<\/strong> (\u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e). \u0412\u0441\u0451 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438\u0437 \u043d\u0438\u0445. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 blue \u043d\u0430 green \u2014 \u0431\u0435\u0437 \u0434\u0430\u0443\u043d\u0442\u0430\u0439\u043c\u0430 \u0438 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0430\u0442\u0430.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (blue) \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a.<\/li>\n\n\n\n<li>\u041d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f (green) \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a.<\/li>\n\n\n\n<li>\u041f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 green.<\/li>\n\n\n\n<li>\u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0445\u0435 \u2014 \u0442\u0440\u0430\u0444\u0438\u043a \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 green (\u043e\u0431\u044b\u0447\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <code>Service<\/code> \u0438\u043b\u0438 <code><a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/kubernetes-ingress\/\" data-internallinksmanager029f6b8e52c=\"363\" title=\"Kubernetes Ingress (\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 Kubernetes)\">Ingress<\/a><\/code>).<\/li>\n\n\n\n<li>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u043e\u0442\u043a\u0430\u0442 \u043a blue \u043f\u0443\u0442\u0451\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Zero-<a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/downtime\/\" data-internallinksmanager029f6b8e52c=\"233\" title=\"Downtime (\u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u044f)\">downtime<\/a><\/strong> \u2014 \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u044f\u0434\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f;<\/li>\n\n\n\n<li><strong>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 rollback<\/strong> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f;<\/li>\n\n\n\n<li><strong>\u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0439<\/strong> \u2014 blue \u0438 green \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b, \u0432\u0435\u0440\u0441\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439;<\/li>\n\n\n\n<li><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/strong> \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/kubernetes\/\" data-internallinksmanager029f6b8e52c=\"259\" title=\"Kubernetes (K8s)\">Kubernetes<\/a>, \u043e\u0431\u043b\u0430\u043a\u0430\u0445 (AWS, GCP, Azure) \u0438 on-prem \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430\u0445.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Kubernetes<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u0421\u0445\u0435\u043c\u0430:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0414\u0432\u0430 <code>Deployment<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430: <code>my-app-blue<\/code>, <code>my-app-green<\/code>;<\/li>\n\n\n\n<li>\u041e\u0434\u0438\u043d <code>Service<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0447\u0435\u0440\u0435\u0437 <code>selector<\/code>;<\/li>\n\n\n\n<li>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 = \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <code>spec.selector<\/code> \u0432 <code>Service<\/code>.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u041f\u0440\u0438\u043c\u0435\u0440:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: my-app-green\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: my-app\n      version: green\n  template:\n    metadata:\n      labels:\n        app: my-app\n        version: green\n    spec:\n      containers:\n        - name: app\n          image: my-registry\/my-app:v2\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Service\nmetadata:\n  name: my-app\nspec:\n  selector:\n    app: my-app\n    version: green  # \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \"\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\"\n  ports:\n    - <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/port\/\" data-internallinksmanager029f6b8e52c=\"225\" title=\"Port (\u041f\u043e\u0440\u0442 )\">port<\/a>: 80\n      targetPort: 8080\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0420\u0430\u0437\u043d\u0438\u0446\u0430: Blue-Green vs. Canary<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u041f\u043e\u0434\u0445\u043e\u0434<\/th><th>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/th><th>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/th><th>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/th><\/tr><\/thead><tbody><tr><td><strong>Blue-Green<\/strong><\/td><td>\u041c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e\u0435<\/td><td>\u0412\u0441\u0451 \u0438\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e<\/td><td>\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/td><\/tr><tr><td><strong>Canary Release<\/strong><\/td><td>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435<\/td><td>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0430<\/td><td>\u0413\u0438\u0431\u043a\u043e\u0435 A\/B \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>AWS<\/strong>: \u0447\u0435\u0440\u0435\u0437 Elastic Beanstalk, ECS \u0438\u043b\u0438 CodeDeploy \u0441 <code>Traffic Routing<\/code>;<\/li>\n\n\n\n<li><strong>Google Cloud<\/strong>: Cloud Run + Traffic Splitting, GKE + Ingress;<\/li>\n\n\n\n<li><strong>On-prem<\/strong>: <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/istio\/\" data-internallinksmanager029f6b8e52c=\"366\" title=\"Istio (\u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Service Mesh)\">Istio<\/a> VirtualService, NGINX Ingress \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438;<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/gitlab-ci-cd\/\" data-internallinksmanager029f6b8e52c=\"372\" title=\"GitLab CI\/CD (\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0432 GitLab)\">CI\/CD<\/a><\/strong>: GitLab, <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/argo-cd\/\" data-internallinksmanager029f6b8e52c=\"352\" title=\"Argo CD\">Argo CD<\/a>, Spinnaker, Flux \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u044b blue-green;<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0412\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0411\u0414) \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439;<\/li>\n\n\n\n<li><strong>\u0421\u043b\u0435\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438<\/strong> \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u2014 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0430\u0442\u0430;<\/li>\n\n\n\n<li><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 feature parity<\/strong> \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438;<\/li>\n\n\n\n<li><strong>\u0427\u0451\u0442\u043a\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f rollback-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/strong> \u2014 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/disaster-recovery\/\" data-internallinksmanager029f6b8e52c=\"238\" title=\"Disaster Recovery (\u0410\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435)\">disaster recovery<\/a>.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Blue-Green Deployment<\/strong> \u2014 \u044d\u0442\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0441\u0440\u0435\u0434, \u0433\u0434\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u0431\u043e\u0435\u0432, \u043e\u0442\u043a\u0430\u0442\u043e\u0432 \u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u0435\u0442\u0441\u044f \u0441 GitOps \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n\n\n\n<p>\u0412\u043e\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u2014 <strong>\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 Blue-Green Deployment<\/strong>, \u0432\u043a\u043b\u044e\u0447\u0430\u044f:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 <code>kubectl<\/code><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/helm-v-kubernetes\/\" data-internallinksmanager029f6b8e52c=\"350\" title=\"Helm (\u0432 Kubernetes)\">Helm<\/a>-\u0447\u0430\u0440\u0442 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0443\u0435\u043c\u043e\u0439 blue\/green-\u043b\u043e\u0433\u0438\u043a\u043e\u0439<\/li>\n\n\n\n<li><a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/grafana\/\" data-internallinksmanager029f6b8e52c=\"356\" title=\"Grafana (C\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445)\">\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433<\/a> \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/prometheus\/\" data-internallinksmanager029f6b8e52c=\"355\" title=\"Prometheus (\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432)\">Prometheus<\/a> \u0438 \u0430\u043b\u0435\u0440\u0442\u0430<\/li>\n\n\n\n<li>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 GitOps (Argo CD \u0438\u043b\u0438 Flux)<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u0421\u043a\u0440\u0438\u043f\u0442: \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 green<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nAPP_NAME=\"my-app\"\nTARGET_VERSION=\"green\"\n\necho \"Switching ${APP_NAME} service to ${TARGET_VERSION}...\"\n\nkubectl patch service ${APP_NAME} \\\n  -p \"{\\\"spec\\\": {\\\"selector\\\": {\\\"app\\\": \\\"${APP_NAME}\\\", \\\"version\\\": \\\"${TARGET_VERSION}\\\"}}}\"\n<\/code><\/pre>\n\n\n\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <code>kubectl patch<\/code> \u043c\u0435\u043d\u044f\u0435\u0442 <code>Service.spec.selector<\/code>, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. Helm-\u0447\u0430\u0440\u0442: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u0435\u043f\u043b\u043e\u0439<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><code>values.yaml<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>deploymentColor: green\nimage:\n  tag: \"v2\"\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><code>deployment.yaml<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>metadata:\n  name: my-app-{{ .Values.deploymentColor }}\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n      version: {{ .Values.deploymentColor }}\n  template:\n    metadata:\n      labels:\n        app: my-app\n        version: {{ .Values.deploymentColor }}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><code>service.yaml<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>spec:\n  selector:\n    app: my-app\n    version: {{ .Values.deploymentColor }}\n<\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c <code>--set deploymentColor=blue<\/code> \u0438\u043b\u0438 <code>green<\/code> \u2014 \u0432\u0441\u0451 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0441\u044f.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433: Prometheus Rule \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>- alert: App5xxAfterBlueGreenSwitch\n  expr: increase(http_requests_total{status=~\"5..\",app=\"my-app\"}&#91;5m]) &gt; 10\n  for: 3m\n  labels:\n    severity: critical\n  annotations:\n    summary: \"\u041e\u0448\u0438\u0431\u043a\u0438 5xx \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\"\n    description: \"\u041d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u044c \u0438 \u043e\u0442\u043a\u0430\u0442\u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.\"\n<\/code><\/pre>\n\n\n\n<p>\u0422\u0430\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. GitOps: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 Argo CD<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Service<\/code> \u0438 \u043e\u0431\u0430 <code>Deployment<\/code> (blue\/green) \u2014 \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c Git.<\/li>\n\n\n\n<li>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e git commit \u2192 <code>service.yaml<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <code>version: green<\/code>.<\/li>\n\n\n\n<li>Argo CD \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, Git \u2014 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043f\u0440\u0430\u0432\u0434\u044b.<\/li>\n<\/ul>\n\n\n\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 Argo Rollouts, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c webhook \u043e\u0442 CI \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 health verification.<\/p>\n\n\n\n<p><strong>CI\/CD-\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f Blue-Green Deployment \u0441 \u0430\u0432\u0442\u043e\u043e\u0442\u043a\u0430\u0442\u043e\u043c<\/strong>, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c GitLab CI \u0438 health check&#8217;\u043e\u0432.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u041f\u0440\u0438\u043c\u0435\u0440 <code>.gitlab-ci.yml<\/code> \u0434\u043b\u044f blue-green \u0434\u0435\u043f\u043b\u043e\u044f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>stages:\n  - deploy\n  - validate\n  - switch\n  - cleanup\n\nvariables:\n  KUBE_CONTEXT: your-kube-context\n  APP_NAME: my-app\n\ndeploy-green:\n  stage: deploy\n  script:\n    - helm upgrade --install ${APP_NAME}-green .\/helm-chart \\\n        --set deploymentColor=green \\\n        --set image.tag=$CI_COMMIT_SHORT_SHA\n  only:\n    - main\n\nvalidate-green:\n  stage: validate\n  script:\n    - echo \"Waiting for pods to be ready...\"\n    - kubectl rollout status deploy\/${APP_NAME}-green --timeout=120s\n    - echo \"Running smoke tests...\"\n    - curl --fail http:\/\/green.my-app.svc.cluster.local\/health\n  only:\n    - main\n\nswitch-service:\n  stage: switch\n  script:\n    - kubectl patch service ${APP_NAME} \\\n        -p \"{\\\"spec\\\": {\\\"selector\\\": {\\\"app\\\": \\\"${APP_NAME}\\\", \\\"version\\\": \\\"green\\\"}}}\"\n  only:\n    - main\n\nrollback-on-failure:\n  stage: switch\n  when: on_failure\n  script:\n    - echo \"Deployment failed. Rolling back service to blue...\"\n    - kubectl patch service ${APP_NAME} \\\n        -p \"{\\\"spec\\\": {\\\"selector\\\": {\\\"app\\\": \\\"${APP_NAME}\\\", \\\"version\\\": \\\"blue\\\"}}}\"\n\ncleanup-blue:\n  stage: cleanup\n  script:\n    - kubectl delete deploy ${APP_NAME}-blue || true\n  only:\n    - main\n  when: manual\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 <strong>green<\/strong>-\u0432\u0435\u0440\u0441\u0438\u044e;<\/li>\n\n\n\n<li>\u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0435\u0451 (\u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043e\u0432 + HTTP health check);<\/li>\n\n\n\n<li>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 <code>green<\/code>;<\/li>\n\n\n\n<li>\u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u0434\u0451\u0442 \u043d\u0435 \u0442\u0430\u043a \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0442\u043a\u0430\u0442 \u043d\u0430 <code>blue<\/code>;<\/li>\n\n\n\n<li>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 <code>blue<\/code>-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u2014 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Smoke test \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/strong> \u2014 e2e-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c;<\/li>\n\n\n\n<li><strong>Prometheus webhook<\/strong> \u2014 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043e\u0448\u0438\u0431\u043e\u043a;<\/li>\n\n\n\n<li><strong>Istio \/ Ingress routing<\/strong> \u2014 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e \u0445\u043e\u0441\u0442\u0443 \u0438\u043b\u0438 path \u0432\u043c\u0435\u0441\u0442\u043e Service patch;<\/li>\n\n\n\n<li><strong>GitOps-\u0441\u0445\u0435\u043c\u0443<\/strong> \u2014 \u0433\u0434\u0435 patch \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c \u0432 <code>service.yaml<\/code> \u0432 Git, \u0430 Argo CD \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"featured_media":0,"parent":2927,"menu_order":172,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-4092","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/4092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/comments?post=4092"}],"version-history":[{"count":1,"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/4092\/revisions"}],"predecessor-version":[{"id":4094,"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/4092\/revisions\/4094"}],"up":[{"embeddable":true,"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/2927"}],"next":[{"title":"Continuous Integration (CI)","link":"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/continuous-integration\/","href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/4099"}],"prev":[{"title":"Kubernetes Ingress (\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 Kubernetes)","link":"https:\/\/cloudvps.by\/community\/docs\/glossarij\/terminy\/kubernetes-ingress\/","href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/docs\/4077"}],"wp:attachment":[{"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/media?parent=4092"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/cloudvps.by\/community\/wp-json\/wp\/v2\/doc_tag?post=4092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}