Welcome to installment #1. This series will cover SQL Server capabilities, their best usages, and whether or not you should use them at all. I will cover a range of topics, from simple to complex. The main of these is to explain what the capability is and how to best implement it. (A little spoiler on the ‘should you’ question…the answer is almost always going to be ‘it depends’.) The first topic I’m going to cover here is a doozy: Kubernetes.
Containers, Pods and Kubelets, Oh My!
I won’t go very in-depth into these technologies, but I’d like to provide a quick overview of them for some context in this post.
With Docker standardizing containers, there has been a huge change in deployment and management of applications. Containers are…amazing. I’ve spent my career in the Windows world, but actively use and enjoy Linux at every opportunity. Containers have revolutionized the way we deploy and manage applications. They are lightweight, single tasked, easy to spin up, pretty resource-efficient and frankly, a joy to work with.
But with containers comes the need to manage them. That’s where Kubernetes comes in. Kubernetes originated from Google’s Borg container management system. Kubernetes manages containers through Deployments, which are typically composed of one or more containers (these are referred to as a pod) and other resources, such as services, persistent volumes and claims. It defines all the required components of your application. These Deployments can also define Readiness and Liveness health checks. These allow Kubernetes to maintain a consistent state of your application. The Readiness check confirms when an application is up and allowing connections and the Liveness check will ensure that if your application is unresponsive, it will be destroyed and recreated. Using these, Kubernetes automatically maintains high availability of your application.
Yes! I’m not going to reinvent the wheel because Microsoft has a great tutorial on deploying SQL Server in Kubernetes. The requirements are:
- A Kubernetes cluster
- Persistent storage on that cluster
- A secret for the SA password
- A deployment file
On the surface they appear straightforward, but in practice (as with any infrastructure) decisions need to be made, based on requirements and adequate research. All your Kubernetes objects should be defined in yaml files to facilitate version control and documentation. You create these files, run a kubectl apply -f file.yaml and there you go.
Well…it depends. If you want to mess around in a non-production environment, absolutely! Always be learning. In fact, at Pass Summit 2018 Bob Ward was emphatically enthusiastic about running SQL Server in Kubernetes. He claimed this was the direction. So, should you jump in the production? Well, let’s pause for a minute to take a few things into consideration.
How familiar are you with Linux, containers and SQL Server?
SQL Server in Linux is still very much a new thing. If you’ve been working with SQL Server for a while, it’s a fair assumption that Windows is your bread and butter. Do you have a full understanding of the differences between Linux SQL Server vs Windows? The code base and functionality are almost identical, but management is very different. In addition to Linux, containers are also very new. Do you know how to troubleshoot a container vs a virtual machine?
How familiar are you with Kubernetes?
Ok, so Linux, containers, and SQL Server are new. So is running them in Kubernetes—and Kubernetes is a very complex system. You can spin-up a cluster on a few Raspberry Pi’s in an hour, but that’s not going to run your production load. There are a lot of components in Kubernetes. Are you going to separate etcd on separate servers, do you have high availability for your master nodes, etc. Cloud-based clusters, like Amazon’s EKS, Azure’s AKS and Google’s GKE, certainly take a lot of work out of the equation. But we’re still back to manageability. You must ensure you have an appropriate load-balancing solution in place because, by default, there is no external connectivity to your pod’s network.
Stateless vs stateful
One important concept to understand is stateless vs stateful. A stateless application does not save any data or client information. A stateful application does save this data. In a classic two-stack web app with a front end and database backend, the web app’s front end is usually stateless while the database is stateful. The front end will query the database for any information it needs. In this manner, the stateless component is ephemeral. It can be disposed and recreated easily. It can be scaled up and scaled down as required. The stateful backend is very different. You can’t simply create a new database because you usually require the existing data.
Containers work amazingly well for stateless components. If a front-end instance isn’t working properly, a new instance can be spun-up. Connections, then, are routed to the new instance and the old instance is destroyed.
Special care must be taken when running a stateful component as a container. This is true using Kubernetes (or another container management system). Data must be preserved and attached to a new instance if the old instance fails. This adds even more complexity to the environment.
At the end of the day, it comes down to not just managing the system, but being comfortable with it and your ability to maintain application SLAs. SLAs are important. They’re how we define the criticality and success of an application.
Migrating to Kubernetes
Containers and Kubernetes are incredibly powerful systems that simply automate HA in your environment, but proper evaluation should be considered. If your organization is interested in container-based SQL Server and Kubernetes—depending on your level of experience—start slow. Spin up a cluster and run Dev and QA workloads and testing extensively. Learn Kubernetes. Break your test databases. Rebuild them. Consider running a pilot system for a few users if possible. One of the best things you can do is run a full production workload as a test.
Bring in experts
If your organization is interested in testing and running SQL Server in Kubernetes, Anexinet can assist in all stages of deployment. We have expertise deploying SQL Server across all environments and operating systems, along with a long history of successful evaluations, migrations and modernization of mission critical systems. Please reach out to us with any questions. We’d love to help you get started.
SQL Server Architect
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
|cookielawinfo-checbox-analytics||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".|
|cookielawinfo-checbox-functional||11 months||The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".|
|cookielawinfo-checbox-others||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.|
|cookielawinfo-checkbox-necessary||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".|
|cookielawinfo-checkbox-performance||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".|
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.