Giter Site home page Giter Site logo

k8s-ingress's Introduction

Create a simple nginx and ingress-controller to expose PODS.

  • Created this scenario on Macbook pro:

    • Install Docker for mac: version Engine: 18.xx.x
    • Enable Kubernetes: Click on Docker icon on the taskbar --> Preferences --> Kubernetes enable-k8s
  • create a nginx-controller using the below command.

    kubectl apply -f mandatory.yaml
  • Enable ingress add-on.

    kubectl apply -f cloud-generic.yaml
  • Verify the nginx-controller pod

    kubectl get pods --all-namespaces -l app=ingress-nginx

Service creation

Create 3 services to deploy on a namespace dev

  • Create a file ns-dev.yaml
  • Deploy the microservices using the configuration in micro-services.yaml
    $ kubectl apply -f micro-services.yaml
  • Create ingress.yaml to route the requests to /hello /banana /apple
  • Deploy ingress rules
    $ kubectl apply -f ingress.yaml
  • Check the pods and ingress rule
    $ kubectl get all -n dev
    
    all-dev
    $ kubectl get ingress -n dev
    
    ingress
  • Append mohan.local.com in /etc/hosts
    127.0.0.1	localhost mohan.local.com
    
  • Verify the output
    $ curl -kv mohan.local.com/hello
    
    output:
    *   Trying ::1...
    * TCP_NODELAY set
    * Connection failed
    * connect to ::1 port 80 failed: Connection refused
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to mohan.local.com (127.0.0.1) port 80 (#0)
    > GET /hello HTTP/1.1
    > Host: mohan.local.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    >
    < HTTP/1.1 200
    < Server: nginx/1.15.9
    < Date: Fri, 29 Mar 2019 20:33:41 GMT
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 18
    < Connection: keep-alive
    <
    * Connection #0 to host mohan.local.com left intact
    {"status":"hello"}%
    

For Ingress Update documentation click here

Ingress Custom configuration click here

k8s-ingress's People

Stargazers

 avatar

Forkers

sasisee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.