Skip to content

Getting started with Minikube in Ubuntu

Thien Nguyen Le Quynh edited this page Jul 7, 2022 · 2 revisions
  1. Get the latest source code

  2. Install minikube

    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
    sudo install minikube-linux-amd64 /usr/local/bin/minikube 
  3. Create folders

    mkdir -p -v $HOME/k8s-yas-data/postgres \
                $HOME/k8s-yas-data/pgadmin \
                $HOME/k8s-yas-data/var/lib/postgres \
                $HOME/k8s-yas-data/var/lib/pgadmin
  4. Start minikube

    minikube start --driver=docker --mount-string $HOME/k8s-yas-data:/k8s-yas-data/ --mount 
  5. Install kubectl

    minikube kubectl -- get pods -A
    echo 'alias kubectl="minikube kubectl --"' >> ~/.bashrc
    source ~/.bashrc
  6. Enable the Ingress controller

    minikube addons enable ingress
  7. Update volume mounts in yaslocal.yaml

  • In the postgres deployment update:

    • mountPath of postgres to "/k8s-yas-data/var/lib/postgresql/data"
    • mountPath of pgadmin to "/k8s-yas-data/var/lib/pgadmin"
  • In the postgres-pv-volume PersistentVolume replace path to "/k8s-yas-data/postgres" and matchExpressions->key->values from docker-desktop to minikube

  • In the pgadmin-pv-volume PersistentVolume replace path to "/k8s-yas-data/pgadmin" and matchExpressions->key->values from docker-desktop to minikube

  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - minikube
  1. Run

    kubectl apply -f yaslocal.yaml 
  2. Run to add to your host file

    echo -e "$(minikube ip) api.yas.local\
    \n$(minikube ip) storefront.yas.local\
    \n$(minikube ip) backoffice.yas.local\
    \n$(minikube ip) identity\
    \n$(minikube ip) pgadmin.yas.local" | sudo tee -a /etc/hosts
Clone this wiki locally