Introduction to Kubernetes

Kubernetes is indeed an open-source container orchestration platform that helps you manage the lifecycle of containerized applications.

Minikube

Minikube is a free open source tool uner Apache License that enables developers to run a local Kubernetes cluster right on their personal computers. By creating a lightweight, single-node environment, it simplifies the process of testing and developing applications in a Kubernetes setting without the need for a complex cloud infrastructure. This makes it an excellent resource for learning and experimenting with Kubernetes features, as it allows users to deploy applications and explore container orchestration in a straightforward manner.

Minikube is great for local development and testing, but it’s not ideal for production use due to its limitations in security and networking. Running as a single-node cluster, it lacks advanced security features like role-based access control (RBAC) and network policies, which are essential for protecting real-world applications. Additionally, its basic networking capabilities don’t support the complexity needed for production environments, such as load balancing and service discovery. Thus, while Minikube is valuable for experimentation and learning, more robust Kubernetes setups are recommended for production scenarios.

Before, you install Minikube,you need to install Docker or other container technology.

The Minikube installation guides can be found at their website minikube.sigs.k8s.io.

To start a new cluster, run this command

minikube start

It may take a few minutes and it will show you some pretty messages such as

?  minikube v1.34.0 on Ubuntu 20.04
?  Automatically selected the virtualbox driver. Other choices: none, ssh
?  Downloading VM boot image ...
    > minikube-v1.34.0-amd64.iso....:  65 B / 65 B [---------] 100.00% ? p/s 0s
    > minikube-v1.34.0-amd64.iso:  333.55 MiB / 333.55 MiB  100.00% 6.79 MiB p/
?  Starting "minikube" primary control-plane node in "minikube" cluster
?  Downloading Kubernetes v1.31.0 preload ...
    > preloaded-images-k8s-v18-v1...:  326.69 MiB / 326.69 MiB  100.00% 6.70 Mi
?  Creating virtualbox VM (CPUs=2, Memory=3900MB, Disk=20000MB) ...
?  Preparing Kubernetes v1.31.0 on Docker 27.2.0 ...
    ? Generating certificates and keys ...
    ? Booting up control plane ...
    ? Configuring RBAC rules ...
?  Configuring bridge CNI (Container Networking Interface) ...
?  Verifying Kubernetes components...
    ? Using image gcr.io/k8s-minikube/storage-provisioner:v5
?  Enabled addons: default-storageclass, storage-provisioner
?  kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
?  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Kube Control

To install kubectl follow their official website at kubernetes.io.

After installation, test your clusters using this command:

kubectl cluster-info

You can also look at your nodes as follow:

kubectl get nodes

for me, it displays

NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   12h   v1.31.0

it refers to the kube I started via minikube start.

To get the namespaces, run

kubectl get namespaces
NAME              STATUS   AGE
default           Active   21h
kube-node-lease   Active   21h
kube-public       Active   21h
kube-system       Active   21h

Kubernetes pods serve as the basic units that contain one or more containers, enabling them to operate together seamlessly. Within a pod, containers share the same network and storage resources, which helps them communicate and work closely together.

To inspect pods and services, run

kubectl get pods -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS      AGE
kube-system   coredns-6f79f6b68f-6vdwz           1/1     Running   0             21h
kube-system   etcd-minikube                      1/1     Running   0             21h
kube-system   kube-apiserver-minikube            1/1     Running   0             21h
kube-system   kube-controller-manager-minikube   1/1     Running   0             21h
kube-system   kube-proxy-6hwt2                   1/1     Running   0             21h
kube-system   kube-scheduler-minikube            1/1     Running   0             21h
kube-system   storage-provisioner                1/1     Running   2 (21h ago)   21h

The flag -A means that you see pods of every namespace.

And to get services running in this cluster:

kubectl get services -A
NAMESPACE     NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  22h
kube-system   kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   22h
kubernetes
docker
Software and digital electronics / IT
Posted by admin
2024-10-22 07:49
×

Login

No account?
Terms of use
Forgot password?