Kubernetes Ingress Controller on Vagrant

2/21/2016

Is there anything special about running ingress controllers on Kubernetes CoreOS Vagrant Multi-Machine? I followed the example but when I run kubectl -f I do not get an address.

Example:

http://kubernetes.io/v1.1/docs/user-guide/ingress.html#single-service-ingress

Setup:

https://coreos.com/kubernetes/docs/latest/kubernetes-on-vagrant.html

I looked at networking in kubernetes. Everything looks like it should run without further configuration.

My goal is to create a local testing environment before I build out a production platform. I'm thinking there's something about how they setup their virtualbox networking. I'm about to dive into the CoreOS cloud config but thought I would ask first.

UPDATE

Yes I'm running an ingress controller.

https://github.com/kubernetes/contrib/blob/master/Ingress/controllers/nginx-alpha/rc.yaml

It runs without giving an error. It's just when I run kubectl -f I do not get an address. I'm thinking there's either two things:

  1. I have to do something extra in networking for CoreOS-Kubernetes vagrant multi-node.
  2. It's running right, but I'm point my localhost to the wrong IP. I'm using a 172.17.4.x ip, I also have 10.0.0.x . I can access services through the 172.17.4.x using a NodePort, but I can get to my Ingress.

Here is the code:

apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx-ingress
  labels:
    app: nginx-ingress
spec:
  replicas: 1
  selector:
    app: nginx-ingress
  template:
    metadata:
      labels:
        app: nginx-ingress
    spec:
      containers:
      - image: gcr.io/google_containers/nginx-ingress:0.1
        imagePullPolicy: Always
        name: nginx
        ports:
        - containerPort: 80
          hostPort: 80

Update 2 Output of commands:

kubectl get pods

NAME                  READY     STATUS    RESTARTS   AGE
echoheaders-kkja7     1/1       Running   0          24m
nginx-ingress-2wwnk   1/1       Running   0          25m

kubectl logs nginx-ingress-2wwnk --previous

Pod "nginx-ingress-2wwnk" in namespace "default": previous terminated container "nginx" not found

kubectl exec nginx-ingress-2wwnk -- cat /etc/nginx/nginx.conf

events {
  worker_connections 1024;
}
http {


}%

I'm running an echoheaders service on NodePort. When I type the node IP and port on my browser, I get that just fine.

I restarted all nodes in virtualbox too.

-- stampede76
coreos
kubernetes
vagrant
virtualbox

1 Answer

5/15/2016

With a lot help from kubernetes irc and slack, I fixed this a while back. If I remember correctly, I had the ingress service listening on a port that was already being used, I think for vagrant. These commands really help:

kubectl get pod <nginx-ingress pod> -o json
kubectl exec <nginx-ingress pod> -- cat /etc/nginx/nginx.conf
kubectl get pods -o wide
kubectl logs <nginx-ingress pod> --previous
-- stampede76
Source: StackOverflow