Click here to Skip to main content
14,363,648 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Kubernetes - Do you use it? Pin
Maximilien9-Aug-19 6:16
memberMaximilien9-Aug-19 6:16 
GeneralRe: Kubernetes - Do you use it? Pin
  Forogar  9-Aug-19 6:29
professional  Forogar  9-Aug-19 6:29 
GeneralRe: Kubernetes - Do you use it? Pin
dandy729-Aug-19 6:35
memberdandy729-Aug-19 6:35 
GeneralRe: Kubernetes - Do you use it? Pin
Marc Clifton9-Aug-19 6:59
protectorMarc Clifton9-Aug-19 6:59 
GeneralRe: Kubernetes - Do you use it? Pin
Pete O'Hanlon9-Aug-19 6:49
protectorPete O'Hanlon9-Aug-19 6:49 
GeneralRe: Kubernetes - Do you use it? Pin
Marc Clifton9-Aug-19 7:01
protectorMarc Clifton9-Aug-19 7:01 
GeneralRe: Kubernetes - Do you use it? Pin
Pete O'Hanlon9-Aug-19 7:35
protectorPete O'Hanlon9-Aug-19 7:35 
GeneralRe: Kubernetes - Do you use it? PinPopular
Ryan Peden9-Aug-19 7:51
staffRyan Peden9-Aug-19 7:51 
I've used it - only for personal projects and not here at CodeProject so far, but I think I can write a bit about its usefulness.

To start, there are two scenarios to consider:

1. You have to set up, maintain, and manage a Kubernetes cluster yourself. This can be a real pain, unless you have a Linux sysadmin handy, or enjoy being one yourself.

2. You're going to use a cloud Kubernetes service. Azure, AWS, and Google Cloud (along with lots of others) offer this, and it's the happy path for developers.

I'll be discussing scenario 2 because it's the situation most developers find themselves in.

I've found that Kubernetes is one of those things where you don't need it until you do, and when you do, it's really nice to have it. To jump on the Kubernetes bandwagon, you first have to jump on the container bandwagon. But it's a fairly easy bandwagon to jump on, conceptually. It's a nice way of ensuring that your app is running in very close to the same environment in production as it was while in development.

This cuts down on those good old bugs where everything works on the developer's machine, then goes to hell in production. It also makes deployment nice and easy. You push your changes to your app's Git repository, then your CI system builds your application and if all the tests pass, bundles it up into a container and pushes that container to a container registry like Docker Hub or Azure Container Registry. Or you can do things the old fashioned way and build the app on your own machine, run the tests (you do have tests, right?), and then manually build the container and push it to a registry.

Now, it's time to deploy. You sign in to your production server and run a command that basically says "hey Docker, pull the latest version of my app from the registry" and poof! Magic! The latest version of your app is on the production server. At this point, you'll usually need to ask Docker to restart the container too, to ensure that the newest version is running.

That took a couple of steps, but it's still pretty nice. No XCOPYing files to servers. No copy-and-pasting via remote desktop. No weird errors caused by forgetting to install a dependency your app needs. Since your app's container is self-contained and has all of the dependencies included, it just works reliably every time.

This is all well and good, and it's often a step up from the ad-hoc prayer and duct tape-based deployment processes that a shocking number of dev teams are using.

But it all falls apart when your application starts getting big enough that you want to split it up into multiple services and/or run multiple instances and load balance between them. Then, instead of just signing in to a single production server and pulling down a new container version, you have to sign in to many machines and pull down one or more containers. Which is a pain.

This is where container orchestration applications like Kubernetes come in handy. Envision the following scenario:

* You have a front-end web application that gets a lot of traffic and you need to run 10 instances of the app and load balance between them
* You have a few back-end services that the front-end web app talks to. You also need multiple instances of these, but not as many instances as your web server
* Two of your back-end services really, really need to always be deployed together so they're always running on the same machine because they need a shared filesystem so one service can process the output of another

So trying to do all of this manually is possible, but trying to do all of this manually becomes a big pain very quickly. When you need to update your services, there's a lot of drudge work involved. And I know that there are plenty of non-Kubernetes ways to automate complex deployments. I've just found Kubernetes to be fairly nice to work with.

Given the scenario above, the process on Azure Kubernetes looks like the following:

* Tell AKS to create a new Kubernetes cluster
* Tell AKS to add some worker nodes to your new cluster. These nodes are just VMs to which AKS can deploy container
* Set up a Kubernetes config file that tells it something like:
* Here's my web service. Its container name is xyz. It needs at least 512MB of RAM, and don't let it use more than 2GB of RAM. You should run at least one instance of it, and at most 10 instances. Scale up only if average CPU use if > 50%.
* Add similar config sections for each of your backend services with RAM and/or CPU minimums and maximums that are appropriate to each service
* Specify that backend service C and backend service D need to always be deployed together. Kubernetes calls this a pod. Specify that the pod should always have a shared volume of a certain size attached.

So, given the above, Kubernetes takes your config file, looks at all of the nodes it has available, and decides where to deploy everything based on the requirements and constraints you've provided. There's lots of flexibility. You don't have to provide a maximum number of instances, for example. You can let Kubernetes keep scaling a service up as long as it has space available on the nodes in the cluster. And if your app grows or experiences a spike in traffic and suddenly needs more horsepower to keep up, no problem. Add more nodes to your cluster and Kubernetes will figure out where and when to spin up new instances of whatever is needed.

Hm, I think I'd better end this here. I came in intending to do a brief overview, and this message is starting to approach article length. Smile | :)

I've mostly just scratched the surface. I've skipped lots of details, but hopefully, I've given a decent enough look at why Kubernetes is something you might care about. It's not the right solution for every problem. If your app will work using just Azure functions, or Azure App Service, or Google App Engine, those are all easier to use. But as we all know, the real world is full of tricky problems that need complex solutions, and in those cases, Kubernetes might just be exactly what you need.
GeneralRe: Kubernetes - Do you use it? Pin
Rick York9-Aug-19 8:55
mveRick York9-Aug-19 8:55 
GeneralRe: Kubernetes - Do you use it? Pin
Marc Clifton9-Aug-19 10:17
protectorMarc Clifton9-Aug-19 10:17 
GeneralRe: Kubernetes - Do you use it? Pin
dandy7210-Aug-19 7:53
memberdandy7210-Aug-19 7:53 
GeneralRe: Kubernetes - Do you use it? Pin
RickZeeland9-Aug-19 8:34
mveRickZeeland9-Aug-19 8:34 
GeneralThought of the Day Pin
OriginalGriff9-Aug-19 5:48
protectorOriginalGriff9-Aug-19 5:48 
GeneralRe: Thought of the Day Pin
PIEBALDconsult9-Aug-19 5:51
protectorPIEBALDconsult9-Aug-19 5:51 
GeneralRe: Thought of the Day Pin
W Balboos9-Aug-19 5:55
mveW Balboos9-Aug-19 5:55 
GeneralRe: Thought of the Day Pin
W Balboos9-Aug-19 5:52
mveW Balboos9-Aug-19 5:52 
GeneralRe: Thought of the Day Pin
Rick York9-Aug-19 5:55
mveRick York9-Aug-19 5:55 
GeneralRe: Thought of the Day Pin
  Forogar  9-Aug-19 6:32
professional  Forogar  9-Aug-19 6:32 
GeneralRe: Thought of the Day Pin
Mike Hankey9-Aug-19 7:11
professionalMike Hankey9-Aug-19 7:11 
NewsAgile: The Truth Will Out Pin
W Balboos9-Aug-19 3:58
mveW Balboos9-Aug-19 3:58 
GeneralRe: Agile: The Truth Will Out Pin
g_p_l9-Aug-19 5:16
memberg_p_l9-Aug-19 5:16 
GeneralRe: Agile: The Truth Will Out Pin
PIEBALDconsult9-Aug-19 5:21
protectorPIEBALDconsult9-Aug-19 5:21 
GeneralRe: Agile: The Truth Will Out Pin
musefan9-Aug-19 5:23
membermusefan9-Aug-19 5:23 
GeneralRe: Agile: The Truth Will Out Pin
W Balboos9-Aug-19 5:35
mveW Balboos9-Aug-19 5:35 
GeneralRe: Agile: The Truth Will Out Pin
#realJSOP9-Aug-19 6:08
mve#realJSOP9-Aug-19 6:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.