This repository contains the script files in order to configure and restart dnsmasq automatically for Kubernetes Ingress LB on minikube after running minikube start
. For more details, see this article (In Japanese).
You can install minikube-ingress-dns with homebrew as follows:
$ brew tap superbrothers/minikube-ingress-dns git://github.com/superbrothers/minikube-ingress-dns.git
$ brew install minikube-ingress-dns
Otherwise you just clone this repository to install:
$ git clone https://github.com/superbrothers/minikube-ingress-dns.git /path/to/minikube-ingress-dns
To work minikube-ingress-dns requires dnsmasq. If you use macOS, you can install dnsmasq by using Homebrew.
$ brew install dnsmasq
If you use Ubuntu desktop, you don't need to install dnsmasq due to it is already installed.
Choose the script file for your environment.
# macOS
alias minikube=/path/to/minikube-ingress-dns/minikube-ingress-dns-macos
# Ubuntu 16.04 LTS
alias minikube=/path/to/minikube-ingress-dns/minikube-ingress-dns-ubuntu16
# Ubuntu 14.04 LTS
alias minikube=/path/to/minikube-ingress-dns/minikube-ingress-dns-ubuntu14
The default base domain for Ingress LB is minikube.local
. For example, if you create an ingress object like the following, you can access http://nginx.minikube.local/ directly with curl, browser or something.
$ minikube start
$ minikube addons enable ingress
$ kubectl create deployment nginx --image=nginx
$ kubectl expose deploy nginx --port=80 --target-port=80
$ cat <<EOL | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx.minikube.local
spec:
rules:
- host: nginx.minikube.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx
port:
number: 80
EOL
$ curl http://nginx.minikube.local/
If you'd like to change the base domain from minikube.local
, set the new domain name to the MINIKUBE_INGRESS_DNS_DOMAIN
environment variable.
export MINIKUBE_INGRESS_DNS_DOMAIN="minikube.local"
These scripts are released under the MIT License.