Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

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.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 30m
Published
Clock icon Nov 26, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install Dependencies

    Install the container runtime, Docker in this case:

    sudo apt install -y docker.io
    
  2. Challenge

    Install Minikube

    Retrieve and then install the Minikube deb package:

    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_1.4.0.deb
    sudo dpkg -i minikube_1.4.0.deb
    

    Once this is installed, set the default driver to none:

    sudo minikube config set vm-driver none
    

    Now start Minikube

    sudo minikube start
    

    Enable 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
    
  3. 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/kubectl
    

    Now we'll have a kubectl file sitting in our directory (ls will 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/bin in this case):

    chmod +x ./kubectl
    sudo mv ./kubectl /usr/local/bin/kubectl
    

    Now we want to make sure that we can see our Minikube setup and our Kubernetes cluster using kubectl:

    sudo kubectl get po -A
    

    Create and Expose a Deployment

    Create a deployment, in this case Nginx:

    sudo kubectl create deployment --image nginx my-nginx
    

    To access the deployment we will need to expose it:

    sudo kubectl expose deployment my-nginx --port=80 --type=NodePort
    

    Once this is done, we need to determine where to access the Nginx default page:

    sudo minikube service list
    

    Once we have the output of this command, we'll aim a curl command 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 our my-nginx as 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>
    
  4. 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 nginx
    

    Edit the Default Site

    sudo vim /etc/nginx/sites-enabled/default
    

    We'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 minikube command we ran a little bit ago. Now we can save the file, then make Nginx read the config again with:

    sudo systemctl restart nginx
    

    Test 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.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans