Topic navigation

Blog Articles

How to Set Up A Kubernetes Developer Box

Kubernetes is a great tool for container orchestration on a server cluster. It makes it easy to deploy lots of containers in a resource-efficient way using a simple interface.

But one thing that is not easy to do with Kubernetes is to deploy it locally. Kubernetes is designed to run on an actual cluster, which means using it only on a single computer is tough.

I know. You’re probably wondering why you’d want to use Kubernetes locally in the first place. The whole point of Kubernetes is to simplify the management of containers on a cluster, right? So running it on a single server might seem like building a second kitchen inside your garage. You could do it, but would it really be that useful?

Well, yes. There are actually some good reasons why you might want to run Kubernetes on a local test box. Maybe you need to test how your apps behave under Kubernetes before putting them into production. Or perhaps you just want to hone your skills, working with the kubectl CLI interface in a safe, sandboxed environment.

Fortunately, it’s possible to run Kubernetes locally for these purposes. In fact, it’s so possible that there’s more than one way to do it. But in this post I’ll cover the most bare-metal route, which involves running Kubernetes through Docker on your local machine.

(Another way to do this is with Vagrant, but that requires running a virtual machine through a traditional hypervisor. A local Kubernetes installation through Docker is much lighter on system resources.)

The only prerequisite — Your development box needs to be running a modern mainstream GNU/Linux distribution such as Red Hat Enterprise Linux, which is available for $0 for development use (you can download it here).

Step 1: Install and Configure Docker and kubectl

We need two tools for this to work. The first is Docker. The procedure for installing Docker varies according to your OS, but in most cases, it can be done easily through the package manager (yum and dnf on RHEL and Fedora). Check out the Docker installation documentation for specifics.

The second tool to grab is kubectl, the Kubernetes CLI tool. You can get this with a quick curl (wget would work fine, too), followed by commands that make the downloaded file executable, and place it in your PATH. The following commands will get the job done:

Step 4: Enjoy

That’s it! With your Kubernetes master running and kubectl installed in your PATH, you can now use the latter to orchestrate your local Kubernetes cluster.

If you want to launch other apps in containers locally so that you can orchestrate them with Kubernetes, feel free to use Docker to do so. You can also check out the kubectl documentation for the complete list of commands available from the tool.

Parting Thoughts

This is a handy way to do some quick testing or experimentation with Kubernetes on a developer box. But it’s also worth acknowledging the downsides of this approach so that you’re aware of the limitations.

The biggest limitation is that this setup doesn’t make it easy to sync your development and testing environments. If you update your app code, you’ll have to restart Docker with Kubernetes and the newer app images manually. If this is a real problem for you, you might have a better experience with Vagrant. Vagrant doesn’t automate the process entirely, but it at least makes it a little faster to start up a new cluster.

The other downside to this method is that it doesn’t involve real networking. It does everything over localhost. In most situations, this should not be a problem. But if you need to test Kubernetes for the orchestration of apps in a cluster containing multiple nodes with different real IP addresses, this won’t work well. In that case, you really need a real cluster (or a set of virtual machines, at least).

Despite these drawbacks, the steps described above are useful if you need to do some quick Kubernetes testing, or if you just want to practice using kubectl.

Hemant Jain

Hemant Jain is the founder and owner of Rapidera Technologies, a full service software development shop. He and his team focus a lot on modern software delivery techniques and tools. Prior to Rapidera he managed large scale enterprise development projects at Autodesk and Deloitte.

Privacy Preference Center

Consent Management

We use cookies on our websites to deliver our online services. Details about how we use cookies and how you may disable them are set out in our Privacy Statement. By using this website you agree to our use of cookies.

Privacy Policy

Required

We use cookies on our websites to deliver our online services. Details about Red Hat's privacy policy, how we use cookies and how you may disable them are set out in our Privacy Page. By using this website you agree to our use of cookies.