Hi folks,
Is there an example somewhere of how to run the ingress controller in minikube ?
I am thinking about more straightforward docs than https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx specific to minikube.
Would be nice to get this out of the box.
-Sebastien
Great idea. If anyone manages to get this working before we do, please send a writeup!
yeah, I cannot get it to work in a regular setup :(
Would you mind attaching what you've tried, so we don't go down the same path :) ?
haven't tried on minikube yet. maybe in couple hours...
Thanks to some help from folks in the slack #minikube channel, I was able to piece together the following gist: https://gist.github.com/numbsafari/40396b18822d9d7ab0bb9f0d8f1f4296
I saved that to a local file named kubernetes-ingress.yaml and then created them on my local minikube instance (using xhyve driver) with the following command:
$ kubectl create -f kubernetes-ingress.yaml
For my own flavor of fun, I then installed and configured dnsmasq:
$ brew install dnsmasq
$ echo address=/dev/`minikube ip` > /usr/local/etc/dnsmasq.conf
$ sudo launchctl stop homebrew.mxcl.dnsmasq
$ sudo launchctl start homebrew.mxcl.dnsmasq
$ sudo mkdir -p /etc/resolver/
$ sudo bash -c "echo 'nameserver 127.0.0.1' > /etc/resolver/dev"
And now:
$ 15:33 $ curl -L x.echoheaders.dev/foo
CLIENT VALUES:
client_address=172.17.0.6
command=GET
real path=/foo
query=nil
request_version=1.1
request_uri=http://x.echoheaders.dev:8080/foo
SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001
HEADERS RECEIVED:
accept=*/*
connection=close
host=x.echoheaders.dev
user-agent=curl/7.43.0
x-forwarded-for=192.168.64.1
x-forwarded-host=x.echoheaders.dev
x-forwarded-port=80
x-forwarded-proto=http
x-real-ip=192.168.64.1
BODY:
-no body in request-
have you tried with a "real" app like a basic ghost deployment ?
ok figured it out. you can use your gist, remove the echo header objects and just add this for ghost.
# ghost app
apiVersion: v1
kind: Pod
metadata:
name: ghost
labels:
run: ghost
spec:
containers:
- image: ghost
name: ghost
ports:
- containerPort: 2368
protocol: TCP
---
# ghost service #1
apiVersion: v1
kind: Service
metadata:
labels:
run: ghost
name: ghost
spec:
ports:
- port: 2368
protocol: TCP
targetPort: 2368
selector:
run: ghost
---
# Create the ingress resource
# https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/examples/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ghost
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: ghost
servicePort: 2368
nothing to do with minikube. thanks @numbsafari
Most helpful comment
Thanks to some help from folks in the slack
#minikubechannel, I was able to piece together the following gist: https://gist.github.com/numbsafari/40396b18822d9d7ab0bb9f0d8f1f4296I saved that to a local file named
kubernetes-ingress.yamland then created them on my local minikube instance (using xhyve driver) with the following command:For my own flavor of fun, I then installed and configured dnsmasq:
And now: