Not able to serve my app via K8 in vagrant

8 views
Skip to first unread message

sahil....@formcept.com

unread,
Sep 28, 2017, 7:00:27 AM9/28/17
to Vagrant
Hello everyone,

I have a doubt and here is my use-case.

I have 4 vagrant machines

K8-master: 192.168.1.11
K8-minion1: 192.168.1.12
K8-minion2: 192.168.1.13
Nginx: 192.168.1.14

My k8s cluster is up and running.

Matser instance has below services:
* etcd
* k8-apiserver
* k8-controller-manager
* k8-scheduler
* flannel

Minion instances are running below services:
* kube-proxy
* kubelet
* docker
* flannel

Nginx instance is running below services:
* nginx
* flannel
* kube-proxy

I am able to deploy my simple app (which is serving a simple index.html page) using busybox docker image with CMD as: httpd -f -p 80

When I try to use NodePort to serve my app to outside world which means my app pods are running on minion1 and minion2 and K8 attach the respective service to any port to the host OS (assume: 30XXX)and when I hit the minion1-IP:<30XXX> or minion2-IP:<30XXX> I am getting the index.html.

So far everything is fine. I can use Nginx as web server and define minions-IP as an upstream. But what if for some reason my one minion goes down some traffic will not be able to see my app. Did I speculate it correctly? Please validate.

Now, here comes Nginx role as an Ingress in K8 cluster. That's why I configured flannel and kube-proxy on Nginx so that it can route traffic to the pods.

In nginx conf file I just give the app k8 service IP and port in the upstream.

But when I try to achieve this it is not working and throwing 500 Gateway error. But when I reproduce the same use-case on AWS it is working fine.

I think there might be some issue with vagrant networking related.

And, why do my all vagrant machines get eth0 as 10.0.2.15 in every vagrant machine? It gets precendence over my assigned IP (public/private).

I am unable to understand this logic. Can someone help me or illuminate me over this issue?

Thanks in advance!

Alvaro Miranda Aguilera

unread,
Sep 28, 2017, 8:19:19 AM9/28/17
to vagra...@googlegroups.com
NGINX should be routing to:

minion1-IP:<30XXX> 
minion2-IP:<30XXX> 

Check when both are up.

Q1. then, one goes down, how nginx knows this?

usually is part of the service discovery process that update nginx.conf with the backends to only update with healthy backends.

Q2. what happens if nginx goes down?

alvaro.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a9730ebb-8960-422b-8f27-69045e6158bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages