Skip to content

mr-anderson86/what_is_host_ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is host's IP

Description

This project contains 2 containers (Pods):

Those applications can work on Docker Compose, or on Minikube / Kubernetes (using Helm) (Created by mr-anderson86, started @12/2021)

Structure

Infrastructure Design

The app and the Nginx are deployed within a closed namespace in Kubernetes (or Docker network), and the user can access only the Nginx.
(Meaning: the Nginx is used as a reversed proxy for the app, while the app is not exposed externally at all)

Prerequisites

For Docker Compose

  • Docker

For Kubernetes

  • minikube (or a kubernetes cluster)
  • helm

Usage

To start the applications

  • Via Docker Compose:
    (need Docker installed on your host/computer)
git clone https://github.com/mr-anderson86/what_is_host_ip.git
cd what_is_host_ip
docker-compose up -d
  • Via Minikube/Kubernetes (using Helm):
git clone https://github.com/mr-anderson86/minimarket_kubernetes.git
cd what_is_host_ip/kubernetes/helm
# helm install [your app name] host-ip, example below:
helm install host-ip host-ip

# Only for minikube:
minikube tunnel

# Note: in minikube also the 2 below commands can work instead of "minikube tunnel":
# minikube service nginx-service --url -n my-host-ip  # but this will give you a different port than 80
# kubectl -n my-host-ip port-forward --address 0.0.0.0 service/nginx-service 80:80

# If you are using an external k8s cluster, then you'll have to retrieve ip from external LB

That's it!
Then all you need is to do is open your browser and go to http://localhost/
And there you will see the external IP address of the host.
(You can also go to http://localhost/api to get full json data)

To stop the applications

  • Via Docker:
    (from the same directory type this command)
docker-compose down
  • Via Helm:
helm uninstall [your app name]