Giter Club home page Giter Club logo

wsl2-minikube's Introduction

Purpose

This repo was originally intended to show the numerous issues one was faced with when trying to use WSL2 with minikube.

Now, after several years and countless hours of testing to get issues worked out, it finally looks like WSL/WSL2 is usable for development (for my use case). Much appreciation to the developers of WSL2 and minikube. I've actually deleted my Linux partition and started using WSL2 full-time.

My use case is the following stack:

  • docker running in WSL2 and not Docker Desktop for Windows
  • kubectl
  • minikube
  • skaffold
  • mkcert for local development TLS certificates

I'm repurposing this repo to demonstrate how to get this stack up and running in WSL2.

For the mkcert implementation, please see this repo.

9/11/21 Update - It seems like this wasn't working properly so I fixed the issue.

11/30/21 Update - Clarified a few steps related to docker and sudo, and where kubectl, minikube, and skaffold should be installed (WSL2).

Setup

Assuming WSL2 is already enabled and using WSL2 Ubuntu 20.04 LTS is already installed.

Refer to the documentation below for the latest installation processes.

  1. git clone https://github.com/cheslijones/wsl2-minikube.git

  2. cd wsl2-minikube

  3. Install docker directly into WSL2:

    Run the following command so you don't have to use sudo for docker commands:

    sudo usermod -aG docker $USER
    

    Then close and reopen WSL2, restart the Lxss service, or sign in and out of Windows... which ever works.

    Of course, every time you boot up Windows you need to start docker in WSL2 with:

    sudo service docker start
    
  4. Install kubectl for Linux in WSL2

  5. Install minikube for Linux in WSL2:

    Go ahead and create a cluster while we are here.

    minikube start --vm-driver=docker
    

    It should spin up in about a minute.

  6. Install skaffold for Linux in WSL2

  7. Install / enable ingress-nginx:

    It is a bit counter-intuitive, but using the Docker for Mac instructions works not only with Docker Desktop for Windows and macOS, but also WSL2:

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.0/deploy/static/provider/cloud/deploy.yaml
    
  8. Run skaffold dev.

  9. In another terminal, run minikube tunnel which should prompt you for sudo credentials:

    $ minikube tunnel
    โ—  The service ingress-nginx-controller requires privileged ports to be exposed: [80 443]
    ๐Ÿ”‘  sudo permission will be asked for it.
    ๐Ÿƒ  Starting tunnel for service ingress-nginx-controller.
    [sudo] password for cheslijones: 
    
  10. Open your preferred browser and navigate to localhost.

    You should see:

    If not:

    • Make sure docker is running (sudo service docker start).
    • Make sure your minikube cluster is running with minikube start.

Questions, Issues and Feedback

Please create an issue if you have any questions, issues running the repo, or have feedback on how I can improve this repo or correct something that is wrong. I'm always looking for ways to improve.

wsl2-minikube's People

Contributors

cheslijones avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.