Kubernetes start configuration
08.05.2024
15 min
The first thing to do to work with Kubernetes is to install Docker (in our case, we chose Docker Desktop, as it is the most convenient for our purposes), kubectl, as well as Minikube, and also do not forget to specify the path to them in the environment variables.
You can find guides on this at these links:
https://docs.docker.com/desktop/install/windows-install/
https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
https://minikube.sigs.k8s.io/docs/start/
To begin with, we can check whether we have all these services installed:
After that, we can start working with Kubernetes, let’s start Minikube first:
minikube start –kubernetes-version=v1.27.2
After that, let’s write two commands to change the docker environment:
minikube docker-env
& minikube -p minikube docker-env –shell powershell | Invoke-Expression
This command uses Minikube to set up a Docker environment in our PowerShell shell. It generates commands to set the environment variables needed for the Docker CLI to interact with the Docker used by Minikube. When we run Invoke-Expression, these commands are executed in the current PowerShell session, setting it up to work with Docker in our Minikube.
Next, go to the directory where our Dockerfile is located, and let’s create an image:
After that, we go to Docker and see which port in the range of 30000-32767 is available:
In our case, it is 32443.
Now we create two files anywhere in the file system in service we will add this port 32443:
Now we go to this directory and write two commands:
After that, we can see if our pods have started:
After that, we can try to use our deployed program:
And we are immediately transferred to the default browser, in which we can see that everything works:
With the help of the kubectl logs PODNAME command, you can check that one of our services has received a request: