Giter Club home page Giter Club logo

k8s-deploy's Introduction

Istio Microservices

Basis for tests

https://github.com/ewolff/microservice-istio/tree/master/microservice-istio-demo

Deploying Services to Docker

$ cd k8s-deploy

$ docker compose up -d

Testing on Docker

$ curl http://localhost:10000/service1/hello
$ curl http://localhost:10000/service1/other

$ curl http://localhost:11000/service2/hello
$ curl http://localhost:11000/service2/other

Stopping Docker

$ docker compose down

Install Istio

https://istio.io/latest/docs/setup/getting-started/

Install Istio Add-ons

$ cd ~/Downloads/istio-1.11.1

$ kc apply -f samples/addons

Deploying to Kubernetes

$ cd k8s-deploy

$ kc apply -f k8s-infrastructure.yml

$ kc apply -f k8s-microservices.yml

Testing on K8s

The istio ingressgateway is listening on localhost port 80

$ curl http://localhost/service1/hello
$ curl http://localhost/service1/other

$ curl http://localhost/service2/hello
$ curl http://localhost/service2/other

Applying load to the Services

$ cd k8s-deploy

$ sh load_service1.sh

$ sh load_service2.sh

Istio Dashboards

$ istioctl dashboard kiali

$ istioctl dashboard jaeger

$ istioctl dashboard envoy deployment/service1

$ istioctl dashboard grafana

For grafana click the Dashboards icon (the four squares) and choose Manage

Applying a JWT required policy

JWT taken from Auth0 server; call is from Postman

$ curl --location --request POST 'https://dev-mbof2xy6.us.auth0.com/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "client_id": "i6r1QdVUzw3vq2izd5VcgqiD46h5qySp",
    "client_secret": "L5WHs135sD2MknMwDdL1m6iPuTY_XXUD-Fq5TkhRji202fIA06VXnb_faBfCLgil",
    "audience": "https://steve.amido.com/identifier",
    "grant_type": "password",
    "username": "[email protected]",
    "password": "Pass1234",
    "scope": "openid offline_access"
}'
$ kc apply -f k8s-jwt.yml

$ curl http://localhost/service1/hello
Hello from service1

$ curl http://localhost/service1/other
RBAC: access denied

$ curl -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IndianE2YW9vRDg2OUt1NkhEOFVFZSJ9.eyJpc3MiOiJodHRwczovL2Rldi1tYm9mMnh5Ni51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NjEyZTI2OWMxOWY4MGYwMDY5ZDQxY2NhIiwiYXVkIjpbImh0dHBzOi8vc3RldmUuYW1pZG8uY29tL2lkZW50aWZpZXIiLCJodHRwczovL2Rldi1tYm9mMnh5Ni51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjMwNTk0MzkwLCJleHAiOjE2MzA2ODA4OTAsImF6cCI6Imk2cjFRZFZVenczdnEyaXpkNVZjZ3FpRDQ2aDVxeVNwIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBhZGRyZXNzIHBob25lIHN0ZXZlQUJDIHN0ZXZlREVGIGNuIHNjb3BlMSBvZmZsaW5lX2FjY2VzcyIsImd0eSI6InBhc3N3b3JkIn0.FkljO6nRiKf5hxeX6Xbuzn9cAOox6-_p4bqtbUATbRluh-rD6JduqMZ6alg6ENEAx42IPNn9wgjWUc5_dCSql8WZOLz5m3bUfj88dm0XPtP4TBT5rtek4_rgikGpY48gtwjfGmeBYj9MZ3VD8NB0Mfx4ilZryU9qXBdNYSxrlHCygo5qjEauWX0XgXFk6HVwA6G7qbQgFDDx0hpEWXA_DPvXgIHX0PWljXZG9U8PWj5CrIzoA2XAlN9kivMbDdjqh_sDYxzdhP1cPWMuiDlBvoy4Dw-5X-ySkVr_l0G-HSQVAZWtbiBi4cGtTilUssbeFrQSoUcVfarmWNW8oZ9h-Q" http://localhost/service1/other
service1 called other service, response was : Hello from service2

Tidying up K8s

$ cd k8s-deploy

$ kc delete -f k8s-jwt.yml

$ kc delete -f k8s-microservices.yml

$ kc delete -f k8s-infrastructure.yml

$ cd ~/Downloads/istio-1.11.1

$ kc delete -f samples/addons

k8s-deploy's People

Contributors

sdavis-amido avatar

Watchers

James Cloos avatar Steve Davis avatar

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.