Test Your Kubernetes Cluster Conformance
July 16, 2019You’ve been dabbling in the world of Kubernetes for a while now and have probably noticed there are a whole lot of vendors packaging their own version of Kubernetes.
You might be having a fun time comparing the upstream Kubernetes version vs the packaged versions put out by Redhat, VMware, and others. But how do we know that those packaged versions are supporting the required APIs so that all Kubernetes clusters have the same baseline of features?
The Cloud Native Computing Foundation (CNCF) runs the certification program to ensure vendors are supporting a “high level of common functionality.” –https://github.com/cncf/k8s-conformance
Luckily for us, we can also use this testing program to check our own clusters to make sure they are conformant. To do this, I’ll be using the Heptio Sonobuoy project to test my own Kubernetes cluster, and you can test whichever cluster you’d like using the same tool.
Run Sonobuoy on Against Your Cluster
To get started, download sonobuoy from the link here and place the sonobuoy binary into your PATH.
Now we can run the sonobuoy tool assuming that our KUBECONFIG is setup and we can issue standard kubectl commands against our existing cluster already. If not, you’ve gotta do that first.
So let’s run the sonobuoy commands and test our cluster.
sonobuoy run --wait --mode quick
I’ve run the sonobuoy command with the –mode quick switch so that the test will do some very basic checks. You can remove this for the full test which will of course take longer.
The tests have been run and now we want to view the results.
results=$(sonobuoy retrieve)
sonobuoy e2e $results
Code language: JavaScript (javascript)
As you can see from my test, I have no failures with my existing Kubernetes cluster which I’m ecstatic about. Of course it shouldn’t fail any tests, I’m deploying Kubernetes through the Heptio Wardroom project.
If you’re really curious, the sonobuoy tests create a zip file with details about your cluster. After running it you’ll notice this new compressed file in your working directory as I have.
If you were to unzip that file you’d see a series of directories related to the tests the tool performed. Below is a screenshot showing a subset of the directories and files.
When you’re all done running your conformance tests, be sure to run the delete command to clean up the resources used to run the tests.
sonobuoy delete --wait
Code language: JavaScript (javascript)
Summary
It’s hard to say which of the packaged versions of Kubernetes will be the most popular a few years from now. I think many people are still trying to figure this out and have questions/concerns about the future. But, the good news is that a common set of features should be available from any certified Kubernetes package. And the better news is that you can test it yourself with the conformance tests. Be sure to run a conformance test before pushing any cluster into a production environment.
A very nice article yet again. Your thoughts, in conclusion, were impressive I think as Kubernetes is quite an ambitious project. No doubt and allows a lot of freedom with development as well. Google is pushing a technology way ahead of its time once again.