New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of running ingress controller #496

Closed
sebgoa opened this Issue Aug 16, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@sebgoa
Member

sebgoa commented Aug 16, 2016

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

@dlorenc

This comment has been minimized.

Contributor

dlorenc commented Aug 16, 2016

Great idea. If anyone manages to get this working before we do, please send a writeup!

@sebgoa

This comment has been minimized.

Member

sebgoa commented Aug 16, 2016

yeah, I cannot get it to work in a regular setup :(

@dlorenc

This comment has been minimized.

Contributor

dlorenc commented Aug 16, 2016

Would you mind attaching what you've tried, so we don't go down the same path :) ?

@sebgoa

This comment has been minimized.

Member

sebgoa commented Aug 16, 2016

haven't tried on minikube yet. maybe in couple hours...

@numbsafari

This comment has been minimized.

numbsafari commented Aug 16, 2016

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-
@sebgoa

This comment has been minimized.

Member

sebgoa commented Aug 16, 2016

have you tried with a "real" app like a basic ghost deployment ?

@sebgoa

This comment has been minimized.

Member

sebgoa commented Aug 16, 2016

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

@sebgoa sebgoa closed this Aug 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment