- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Installing Minikube in the Cloud
In this hands-on lab we will be installing Minikube on an Ubuntu server in the Linux Academy Cloud playground. This means that we will need to ensure that all of the dependencies are met, and that we are installing the correct version Minikube. Once we have Minikube installed, we will deploy an Nginx container to ensure that our installation is working correctly.
Lab Info
Table of Contents
-
Challenge
Install Dependencies
Install the container runtime, Docker in this case:
sudo apt install -y docker.io -
Challenge
Install Minikube
Retrieve and then install the Minikube
debpackage:curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_1.4.0.deb sudo dpkg -i minikube_1.4.0.debOnce this is installed, set the default driver to none:
sudo minikube config set vm-driver noneNow start Minikube
sudo minikube startEnable Users to Manage Environments
For the developers to manage their own environments, they need to own certain directories. Let's give them ownership with this:
sudo chown -R $USER $HOME/.kube $HOME/.minikube -
Challenge
Create and Expose a Deployment
In order to create a deployment we will need to install kubectl:
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectlNow we'll have a
kubectlfile sitting in our directory (lswill show it) that we have to execute. Make it executable first, then move it to one of the directories where other executables are stored (/usr/local/binin this case):chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectlNow we want to make sure that we can see our Minikube setup and our Kubernetes cluster using
kubectl:sudo kubectl get po -ACreate and Expose a Deployment
Create a deployment, in this case Nginx:
sudo kubectl create deployment --image nginx my-nginxTo access the deployment we will need to expose it:
sudo kubectl expose deployment my-nginx --port=80 --type=NodePortOnce this is done, we need to determine where to access the Nginx default page:
sudo minikube service listOnce we have the output of this command, we'll aim a
curlcommand at the Nginx service on the service IP and port that the service has mapped to. Look for the row in the output of that last command that has ourmy-nginxas a NAME. There's a local IP and port in the TARGET PORT column. Our next command will look something like this:curl http://<LOCAL_IP>:<PORT> -
Challenge
Create an Nginx Proxy to Access the Installed Application from the Public IP Address
In order to expose our application, we've got to install a proxy first:
sudo apt install -y nginxEdit the Default Site
sudo vim /etc/nginx/sites-enabled/defaultWe're going to change the line that reads:
try_files $uri $uri/ =404;so that it instead reads something like:
proxy_pass http://<LOCAL_IP>:<PORT>;This is going to be right around line 50 in the file, and note that this http address and port we've added are what we got from the
minikubecommand we ran a little bit ago. Now we can save the file, then make Nginx read the config again with:sudo systemctl restart nginxTest in a Browser
Back on our hands-on lab overview page, grab the public IP of our server. Paste that address into a new browser tab, and we should land at our Welcome to nginx! page.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.