{"id":3096,"date":"2019-11-05T10:03:08","date_gmt":"2019-11-05T15:03:08","guid":{"rendered":"http:\/\/www.soul-repairs.com\/blog\/?p=3096"},"modified":"2019-11-02T20:51:36","modified_gmt":"2019-11-03T00:51:36","slug":"openshift-4-migration-a-sample-path","status":"publish","type":"post","link":"https:\/\/soul-repairs.com\/blog\/2019\/11\/05\/openshift-4-migration-a-sample-path\/","title":{"rendered":"OpenShift 4 Migration: A sample path"},"content":{"rendered":"<h2>The Problem<\/h2>\n<p>Moving stuff between Kubernetes clusters can be a pain in the butt. You have to do this when:<\/p>\n<ul>\n<li>Migrating between container platforms, such as <a href=\"https:\/\/aws.amazon.com\/eks\/\">EKS<\/a> -&gt; <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/aks\/\">AKS<\/a><\/li>\n<li>Upgrading clusters when you want to upgrade in parallel (move everything from old to new) as opposed to upgrading in-place (update one cluster from old to new). This would be something like what we&#8217;ll talk about in a minute, going from OpenShift 3.x to OpenShift 4.x<\/li>\n<li>Moving work\/applications between clusters, e.g. two clusters in different datacenters<\/li>\n<\/ul>\n<p>Migrating work between clusters requires some thought and planning, and good solid processes. Specifically, the migration from OpenShift 3.x to OpenShift 4.x <em>requires<\/em> a parallel upgrade, because there is no in-place upgrade available for all of <a href=\"https:\/\/www.redhat.com\/en\/openshift-4\/details\">the new goodies in RHEL CoreOS<\/a> (the underlying infrastructure of the cluster). <a href=\"https:\/\/blog.openshift.com\/introducing-red-hat-openshift-4-2-developers-get-an-expanded-and-improved-toolbox\/\">OpenShift 4.2<\/a> released recently, so we thought it would be good timing to put our migration thoughts down here. However, the advice below is generally good for any Kubernetes cluster parallel upgrade or other migration.<\/p>\n<p><!--more--><\/p>\n<h2>The Plan<\/h2>\n<h3>1. Understand what&#8217;s new and fundamentally different for OpenShift 4.<\/h3>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=921NezIOJNw&amp;list=PLaR6Rq6Z4IqdIM7LtosKqi3LlYXyxjwnj&amp;index=11&amp;t=0s\">This video<\/a>, talking about the upstream OKD, is pretty good, and <a href=\"https:\/\/blog.openshift.com\/wp-content\/uploads\/Red-Hat-OpenShift-4.0-Roadmap-Public-Feb-2019-Ali.pdf\">these slides<\/a> cover a lot of important stuff. If you&#8217;re a Red Hat customer, contact your account team &#8211; they can talk you through the platform updates and discuss your situation in detail. Be sure to talk about what you&#8217;re currently using OpenShift for, and what you plan to use it for, and also any pain points you have with what you&#8217;re doing today.<\/p>\n<p>The big OpenShift changes come in three big chunks: security (including the CoreOS changes), operations (specifically operators and finding ways to lessen the need for esoteric infrastructure knowledge), and <a href=\"https:\/\/developers.redhat.com\/openshift\/\">enablement of developers<\/a>.<\/p>\n<h3>2. Make the Plan!<\/h3>\n<p>Get your infrastructure\/operations people, your architects, and your DevOps people in a room (ideally with a whiteboard or two), and talk through the plan. Talk about if you want help migrating, and if so, how much. OpenShift 4.2 comes with a migration tool that will do at least some of the work for you. The migration tool can automate your migration, project-by-project, which is pretty slick. Check out this video:<\/p>\n<p><iframe loading=\"lazy\" title=\"Migration of MS-SQL Server from OpenShift 3.11 to OpenShift 4.1\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/oVJPxGMy-2g?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>If you&#8217;re migrating between various versions of OpenShift, this tool will work nicely for you. Project-by-project is a fine place to start with an OpenShift migration, because projects typically represent logical buckets of applications or teams. If you prefer to write your own migration script, you can also do that via any scripting tool that has access to your clusters &#8211; Jenkins, Ansible, etc, all of these will work fine. Tools like <a href=\"https:\/\/github.com\/containers\/skopeo\">Skopeo<\/a> (for image migration) and <a href=\"https:\/\/blog.kubernauts.io\/backup-and-restore-of-kubernetes-applications-using-heptios-velero-with-restic-and-rook-ceph-as-2e8df15b1487\">Valero<\/a> (for application component migration) can also be helpful.<\/p>\n<h3>3. The Migration Script in Concept<\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">First, verify all incoming networking traffic goes through a front-end load balancer or obeys DNS rules that you can control.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3123 aligncenter\" src=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-1-incoming-traffic--300x273.png\" alt=\"\" width=\"348\" height=\"317\" srcset=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-1-incoming-traffic--300x273.png 300w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-1-incoming-traffic--297x270.png 297w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-1-incoming-traffic-.png 627w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><br \/>\n<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Spin up the new OpenShift cluster &#8211; don\u2019t route live traffic to it yet<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3124 aligncenter\" src=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-3-routing-pre-switch-300x229.png\" alt=\"\" width=\"426\" height=\"325\" srcset=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-3-routing-pre-switch-300x229.png 300w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-3-routing-pre-switch-768x585.png 768w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-3-routing-pre-switch-354x270.png 354w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-3-routing-pre-switch.png 815w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><br \/>\n<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Install the components on the new cluster necessary to support the migration&#8217;s automation &#8211; the migration tool if doing OpenShift -&gt; OpenShift, or the things necessary for Jenkins\/Ansible\/Skopeo\/etc to work.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Migrate a tester project or two, with all included components, between clusters using your automation of choice. Make sure the tester project is functional and that the applications within it start and run. Pick stateless apps and be careful where they&#8217;re writing their data to.<\/span><\/span><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3125 aligncenter\" src=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster-300x186.png\" alt=\"\" width=\"534\" height=\"331\" srcset=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster-300x186.png 300w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster-768x477.png 768w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster-1024x636.png 1024w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster-434x270.png 434w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-2-new-cluster.png 1062w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\" \/><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Once you&#8217;ve verified the cluster is up and the migration automation works, work through a few more projects to test the automation out. Don&#8217;t change routing over to the new cluster just yet, this is to test out your process and make sure it will be smooth at go time.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Now that your confidence in your process is more solid, pick a date to change the cluster routing &#8211; to officially point to the new cluster instead of the old one.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the cluster routing change date: block deploys to the old cluster<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Run your full migration automation again, to pick up any changes since the last time.<\/span>\n<ol>\n<li><span style=\"font-weight: 400;\">For stateless apps: just migrate them! One of the beauties of stateless apps.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">For stateful apps (there will be a longer outage for these, sadly, if you don&#8217;t want the database\/other &#8220;state&#8221; to get very confused): <\/span>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Shut down access to the old cluster\u2019s stateful apps<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">run the migration<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Start those apps on the new cluster<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Do final testing of apps on your new cluster (ideally, this would be covered with health checks so it isn&#8217;t by-hand testing).<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Officially switch the routing so that work goes to the new cluster.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3126 aligncenter\" src=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-4-post-routing-300x229.png\" alt=\"\" width=\"483\" height=\"369\" srcset=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-4-post-routing-300x229.png 300w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-4-post-routing-768x587.png 768w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-4-post-routing-353x270.png 353w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/migration-4-post-routing.png 822w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><br \/>\n<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Verify that the new routing is working well.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Done! High five each other, and enjoy your new features and fun new Kubernetes toys!<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3132 aligncenter\" src=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme-300x169.jpg\" alt=\"\" width=\"503\" height=\"283\" srcset=\"https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme-300x169.jpg 300w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme-768x432.jpg 768w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme-1024x576.jpg 1024w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme-480x270.jpg 480w, https:\/\/soul-repairs.com\/blog\/wp-content\/uploads\/2019\/11\/its-time-celebration-meme.jpg 1333w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><br \/>\n<\/span><\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>We intend this as a high-level instruction regarding Kubernetes cluster migration. Migration can be stressful and painful, or it can be relatively smooth &#8211; and usually it&#8217;s planning, and having time to practice and automate that makes <em>all the difference<\/em>. Red Hat tries to make this as easy as possible, and we&#8217;ve been pushing Kubernetes upgrades since 1.0, but it helps to talk to people who have done it before and have seen the common pitfalls.<\/p>\n<p>If you have questions, please ask here or hit us up on Twitter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Problem Moving stuff between Kubernetes clusters can be a pain in the butt. You have to do this when: Migrating between container platforms, such as EKS -&gt; AKS Upgrading clusters when you want to upgrade in parallel (move everything from old to new) as opposed to upgrading in-place (update one cluster from old to &hellip; <\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/soul-repairs.com\/blog\/2019\/11\/05\/openshift-4-migration-a-sample-path\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[41,4],"tags":[82,87,44,162,161,83],"wf_post_folders":[],"coauthors":[11,26],"class_list":["post-3096","post","type-post","status-publish","format-standard","hentry","category-processes","category-technology","tag-docker","tag-kubernetes","tag-openshift","tag-openshift-4","tag-platform-migration","tag-technology-tldr"],"_links":{"self":[{"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/posts\/3096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/comments?post=3096"}],"version-history":[{"count":16,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/posts\/3096\/revisions"}],"predecessor-version":[{"id":3143,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/posts\/3096\/revisions\/3143"}],"wp:attachment":[{"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/media?parent=3096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/categories?post=3096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/tags?post=3096"},{"taxonomy":"wf_post_folders","embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/wf_post_folders?post=3096"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/soul-repairs.com\/blog\/wp-json\/wp\/v2\/coauthors?post=3096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}