As you can see on its web page, Kubernetes (k8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
Kubernetes runs anywhere Linux does: your laptop, globally distributes data centers, major cloud providers, and so on. Stating from 5th June 2018 AWS EKS is generally available. K8S also runs on Google Cloud Platform (GCP) through its Google Container Engine (GKE).
If you want K8S in your workstation, the solution is Minikube. Minikube allows you to run the actual K8S code locally on your machine, avoiding the complexity, expense and slower response of a remote cluster; it is well supported for development and testing; it is not a prodution technology and cannot relied upon for production workloads.
Basic concepts about Kubernetes
- Kubernetes deployments are the high-level construct that define an application
- Pods are instances of a container in a deployment
- Services are endpoints that export ports to the outside world
Kubernetes “deployments” are the high-level construct that define an
application
Installing kubectl
Kubectl is the Kubernetes command line tools. In order to install it, you must follow this page.
If you are on Ubuntu or one of other Linux distributions that support snap package manager, kubectl is available as a snap application.
[crayon-641d7753b3618938044006/]
In order to verify your installation, execute
[crayon-641d7753b3628338063735/]
Do not be alarmed at the error above. This is just because we have not set up a Kubernetes instance.
You can also install kubectl using curl
[crayon-641d7753b362d860603744/]
Installing Minikube
First of all, you need to have a hypervisor installed; you can follow the instructions to, for example, install VirtualBox at this page (for Linux). Your machine must have activated VT-X/AMD-v in BIOS.
We are going to follow instructions for Linux of this page. Again, we can make the installation using curl.
[crayon-641d7753b3632605069459/]
The result is
1 2 3 4 5 6 |
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 37.3M 100 37.3M 0 0 22.7M 0 0:00:01 0:00:01 --:--:-- 22.7M [sudo] password for lostinsoftware: rm: remove regular file 'minikube'? y |
Let’s start playing with minikube just using simple commands.
- Start minikube: minikube start
- Deploy a sample: kubectl run hello-minikube –image=gcr.io/google_containers/echoserver:1.4 –port=8080
- Expose this deployment to an external network: kubectl expose deployment hello-minikube –type=NodePort
- List the “pods” of this deployment: kubectl get pod
- Access the sample service: curl $(minikube service hello-minikube –url)
- Delete the deployment: kubectl delete deployment hello-minikube
- Stop minikube: minikube stop
Note for Windows:
When you start minikube the first time, you must be on the drive the Users directory is located on (usually on disk C:). If you are on disk D:, you will get an error similar to:
Error creating host: Error creating machine: The system cannot find the path specified
This error is due to the fact that command cd /Users fails if you are not on disk where /Users is.
An example of starting minikube in Windows is:
[crayon-641d7753b363f104286369/]
Results of the rest of commands are:
[crayon-641d7753b3643886248409/]
Sorry, the comment form is closed at this time.