fernandohackbart / bikeride-lagom

Sample Bike Ride application backend to learn Lagom
Other
4 stars 2 forks source link

Minikube expose to network using NGINX #162

Closed fernandohackbart closed 7 years ago

fernandohackbart commented 7 years ago

Yes this is weird but I want to be able to call the services from the network

zypper install -y nginx

mkdir -p /etc/nginx/vhosts.d

#The IP is gotten from minikube ip

cat > /etc/nginx/vhosts.d/minikube.conf <<EOF
upstream kubernetes {
  server 192.168.42.122:30000;
}
server {
  server_name kubernetes_proxy;
  listen 0.0.0.0:30000;
  location / {
        proxy_pass      http://kubernetes/;
  }
}

upstream jenkins {
  server 192.168.42.122:30010;
}
server {
  server_name jenkins_proxy;
  listen 0.0.0.0:30010;
  location / {
        proxy_pass      http://jenkins/;
  }
}

upstream kong{
  server 192.168.42.122:30020;
}
server {
  server_name kong_proxy;
  listen 0.0.0.0:30020;
  location / {
        proxy_pass      http://kong/;
  }
}

upstream kong_admin{
  server 192.168.42.122:30022;
}
server {
  server_name kong_admin_proxy;
  listen 0.0.0.0:30022;
  location / {
        proxy_pass      http://kong_admin/;
  }
}
EOF

systemctl restart nginx
fernandohackbart commented 7 years ago
cat > /root/bin/generate-minikube-proxy.sh <<EOF
#!/bin/bash

export MINIKUBE_IP=\`minikube ip\`

cat > /etc/nginx/vhosts.d/minikube.conf <<FINAL
upstream kubernetes {
  server \${MINIKUBE_IP}:30000;
}
server {
  server_name kubernetes_proxy;
  listen 0.0.0.0:30000;
  location / {
        proxy_pass      http://kubernetes/;
  }
}

upstream jenkins {
  server \${MINIKUBE_IP}:30010;
}
server {
  server_name jenkins_proxy;
  listen 0.0.0.0:30010;
  location / {
        proxy_pass      http://jenkins/;
  }
}

upstream kong{
  server \${MINIKUBE_IP}:30020;
}
server {
  server_name kong_proxy;
  listen 0.0.0.0:30020;
  location / {
        proxy_pass      http://kong/;
  }
}

upstream kong_admin{
  server \${MINIKUBE_IP}:30022;
}
server {
  server_name kong_admin_proxy;
  listen 0.0.0.0:30022;
  location / {
        proxy_pass      http://kong_admin/;
  }
}
FINAL

systemctl restart nginx

EOF