{"id":24862,"date":"2018-04-17T06:46:14","date_gmt":"2018-04-17T13:46:14","guid":{"rendered":"http:\/\/joeydantoni.com\/?p=1956"},"modified":"2018-04-17T06:46:14","modified_gmt":"2018-04-17T13:46:14","slug":"kubernetes-part-iii-the-failover-and-the-rolling-upgrade","status":"publish","type":"post","link":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/","title":{"rendered":"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade"},"content":{"rendered":"

If you have been following this series, you\u2019ve learned how to install and configure minikube and get started with running SQL Server within Kubernetes. In the final part of this series, you will learn about how failover works, and how you can do an rolling upgrade of SQL Server.<\/p>\n

How This Works<\/h2>\n

Kubernetes works kind of like Windows Failover Clustering does–in that, since we have defined our service, it runs a health check on our pod running SQL Server. There is also a notion of auto-healing–our service should match our deployment manifest which is called Desired State<\/strong>, which means if our pod <\/strong>(the unit of our containment) goes away, the Kubernetes control plane will bring back our pod and therefore database. In the event that a node were to go away, since our deployment is stored in the Kubernetes master, SQL Server will come back online. The timing on this failover is very similar to a SQL Server Failover Cluster restart–as crash recovery will need to be performed. Let\u2019s see how this works. In this first shot, we have a working instance–with a database called demo.<\/p>\n

\"s1\"<\/p>\n

Next–I\u2019m going to use the kubectl delete pod <\/strong>command, where we will remove our container.<\/p>\n

\"s2\"<\/p>\n

As you can see in the kubectl get pod <\/strong>command, we have one container terminating and another creating. Next, I will run the kubectl logs <\/strong>command to get the log from our container–this is just the SQL Server error log, because it is written to stdout (that\u2019s the standard output) in Linux.<\/p>\n

\"s3\"<\/p>\n

Now, I can log back into my container and see my database.<\/p>\n

\"Screen<\/p>\n

Performing a Rolling Upgrade<\/h2>\n

One of the other cool things we can do is a rolling upgrade. In the manifest I supplied, when you build your container, you will always get the latest release of SQL Server. However, you can specify a specific CU–in this next example, I will change the image line in my manifest to pull down CU4 to image: microsoft\/mssql-server-linux:2017-CU4.<\/em> I\u2019ve deployed that here, as you can see.<\/p>\n

\"Screen<\/p>\n

So, I\u2019m simply going to change the image line in my manifest line, from CU4 to CU5 and then redeploy our manifest using the kubectl apply -f<\/strong>\u00a0command. You will want to have deployed the version of SQL Server to test environment in your cluster to reduce your downtime–when you deploy the image is local to your cluster, which means the time to spin up your new container will be much lower.<\/p>\n

You can see how that process worked in this screenshot.<\/p>\n

\"Screen<\/p>\n

We\u2019ve redeployed the template (which you can see by the change to deployment configured<\/strong> response from K8s) our pod terminated and restarted, and then SQL Server upgraded, and we were able to connect.<\/p>\n

Summary<\/h2>\n

I hope you enjoyed this series of posts–I really feel like Kubernetes represents the future of infrastructure whether in the cloud or on-premises. Software defined infrastructure, and persisted storage make it easy to deploy and manage. When SQL Server gets some more features–the main ones I\u2019m looking for are AD authentication and Always On Availability Groups, I think you will see far more widespread use of SQL Server on containers.<\/p>\n","protected":false},"excerpt":{"rendered":"

If you have been following this series, you’ve learned how to install and configure minikube and get started with running SQL Server within Kubernetes. In the final part of this series, you will learn about how failover works, and how you can do an rolling upgrade of SQL Server. How This Works Kubernetes works kind […]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[551,63],"tags":[],"class_list":["post-24862","post","type-post","status-publish","format-standard","hentry","category-blog","category-sql"],"yoast_head":"\nKubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting\" \/>\n<meta property=\"og:description\" content=\"If you have been following this series, you’ve learned how to install and configure minikube and get started with running SQL Server within Kubernetes. In the final part of this series, you will learn about how failover works, and how you can do an rolling upgrade of SQL Server. How This Works Kubernetes works kind […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/\" \/>\n<meta property=\"og:site_name\" content=\"Denny Cherry & Associates Consulting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DennyCherryAssociatesConsulting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-17T13:46:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630\" \/>\n<meta name=\"author\" content=\"Joey D'Antoni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dcacco\" \/>\n<meta name=\"twitter:site\" content=\"@dcacco\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joey D'Antoni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/\",\"url\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/\",\"name\":\"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting\",\"isPartOf\":{\"@id\":\"https:\/\/www.dcac.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630\",\"datePublished\":\"2018-04-17T13:46:14+00:00\",\"dateModified\":\"2018-04-17T13:46:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.dcac.com\/#\/schema\/person\/ac58f2207d3f180aa3e4ee0ce6af0885\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage\",\"url\":\"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630\",\"contentUrl\":\"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.dcac.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dcac.com\/#website\",\"url\":\"https:\/\/www.dcac.com\/\",\"name\":\"Denny Cherry & Associates Consulting\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dcac.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dcac.com\/#\/schema\/person\/ac58f2207d3f180aa3e4ee0ce6af0885\",\"name\":\"Joey D'Antoni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dcac.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3fede03569772a55a091b587d76f78d4?s=96&r=x\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3fede03569772a55a091b587d76f78d4?s=96&r=x\",\"caption\":\"Joey D'Antoni\"},\"url\":\"https:\/\/www.dcac.com\/author\/joeydcac-co\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/","og_locale":"en_US","og_type":"article","og_title":"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting","og_description":"If you have been following this series, you’ve learned how to install and configure minikube and get started with running SQL Server within Kubernetes. In the final part of this series, you will learn about how failover works, and how you can do an rolling upgrade of SQL Server. How This Works Kubernetes works kind […]","og_url":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/","og_site_name":"Denny Cherry & Associates Consulting","article_publisher":"https:\/\/www.facebook.com\/DennyCherryAssociatesConsulting\/","article_published_time":"2018-04-17T13:46:14+00:00","og_image":[{"url":"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630","type":"","width":"","height":""}],"author":"Joey D'Antoni","twitter_card":"summary_large_image","twitter_creator":"@dcacco","twitter_site":"@dcacco","twitter_misc":{"Written by":"Joey D'Antoni","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/","url":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/","name":"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade – Denny Cherry & Associates Consulting","isPartOf":{"@id":"https:\/\/www.dcac.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage"},"image":{"@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage"},"thumbnailUrl":"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630","datePublished":"2018-04-17T13:46:14+00:00","dateModified":"2018-04-17T13:46:14+00:00","author":{"@id":"https:\/\/www.dcac.com\/#\/schema\/person\/ac58f2207d3f180aa3e4ee0ce6af0885"},"breadcrumb":{"@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#primaryimage","url":"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630","contentUrl":"https:\/\/joedantoni.files.wordpress.com\/2018\/04\/s1.png?w=630"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dcac.com\/2018\/04\/17\/kubernetes-part-iii-the-failover-and-the-rolling-upgrade\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dcac.com\/"},{"@type":"ListItem","position":2,"name":"Kubernetes, Part III\u2013The Failover and The Rolling Upgrade"}]},{"@type":"WebSite","@id":"https:\/\/www.dcac.com\/#website","url":"https:\/\/www.dcac.com\/","name":"Denny Cherry & Associates Consulting","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dcac.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dcac.com\/#\/schema\/person\/ac58f2207d3f180aa3e4ee0ce6af0885","name":"Joey D'Antoni","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dcac.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3fede03569772a55a091b587d76f78d4?s=96&r=x","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3fede03569772a55a091b587d76f78d4?s=96&r=x","caption":"Joey D'Antoni"},"url":"https:\/\/www.dcac.com\/author\/joeydcac-co\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/posts\/24862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/comments?post=24862"}],"version-history":[{"count":1,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/posts\/24862\/revisions"}],"predecessor-version":[{"id":24872,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/posts\/24862\/revisions\/24872"}],"wp:attachment":[{"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/media?parent=24862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/categories?post=24862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dcac.com\/wp-json\/wp\/v2\/tags?post=24862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}