diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e7c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/Istio/NetworkPolicies/README.md b/Istio/NetworkPolicies/README.md old mode 100644 new mode 100755 diff --git a/Istio/README.md b/Istio/README.md old mode 100644 new mode 100755 diff --git a/Istio/bookshelf/README.md b/Istio/bookshelf/README.md old mode 100644 new mode 100755 diff --git a/Istio/bookshelf/bookinfo-gateway.yaml b/Istio/bookshelf/bookinfo-gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/bookshelf/bookinfo.yaml b/Istio/bookshelf/bookinfo.yaml old mode 100644 new mode 100755 diff --git a/Istio/cert-manager/README.md b/Istio/cert-manager/README.md old mode 100644 new mode 100755 diff --git a/Istio/envoy/01-envoy_add_headers/README.md b/Istio/envoy/01-envoy_add_headers/README.md old mode 100644 new mode 100755 diff --git a/Istio/envoy/01-envoy_add_headers/deployment.yaml b/Istio/envoy/01-envoy_add_headers/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/envoy/01-envoy_add_headers/envoy.yaml b/Istio/envoy/01-envoy_add_headers/envoy.yaml old mode 100644 new mode 100755 diff --git a/Istio/envoy/01-envoy_add_headers/envoy2.yaml b/Istio/envoy/01-envoy_add_headers/envoy2.yaml old mode 100644 new mode 100755 diff --git a/Istio/envoy/01-envoy_add_headers/gateway.yaml b/Istio/envoy/01-envoy_add_headers/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/envoy/README.md b/Istio/envoy/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/README.md b/Istio/istio-classic/README.md old mode 100644 new mode 100755 index 50fa73b..219995b --- a/Istio/istio-classic/README.md +++ b/Istio/istio-classic/README.md @@ -1,4 +1,23 @@ +# Examples + +ALL NEEDS DOCUMENTATION + +- 01-2_deployments_method +- 02-DirectResponse-HTTP-Body +- 03-HTTPRewrite +- 04-HTTPRedirect +- 05a-FaultInjection-delay +- 05b-FaultInjection-abort + + +# TODO +06-mTLS (pending) + + + + + Multiple Ingress https://youtu.be/QIkryA8HnQ0 diff --git a/Istio/istio-classic/ingress.yaml b/Istio/istio-classic/ingress.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/monitoring/tmp.yaml b/Istio/istio-classic/monitoring/tmp.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/README.md b/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/README.md old mode 100644 new mode 100755 index 4f61d0e..e13e411 --- a/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/README.md +++ b/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/README.md @@ -58,17 +58,30 @@ hosts: "*" ```yaml -hosts: "*" -uri: "/helloworld" -rewrite: - uri: "/" + hosts: + - "*" + gateways: + - helloworld-gateway + http: + - match: + - uri: + exact: /helloworld + route: + - destination: + host: helloworld + port: + number: 80 + rewrite: + uri: "/" ``` -- Allows the traffic from that have any domain. +- Allows the traffic that have as a destination any domain. - Only allows traffic that has as a destination the directory/path `/helloworld`. - `rewrite.uri` allows to redirect the traffic towards the root directory of the service, as the service(s) used don't have any directory named `helloworld` but are configured to work at the root base level. +- Traffic request is sent to the service named `helloworld`, to the service port 80. + # Run example ## Deploy resources diff --git a/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/deployment.yaml b/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/gateway.yaml b/Istio/istio-classic/simple/01-hello_world_1_service_1_deployment/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/README.md b/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/deployment.yaml b/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/gateway.yaml b/Istio/istio-classic/simple/02-hello_world_1_service_2_deployments_unmanaged/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/README.md b/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/deployment.yaml b/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/gateway.yaml b/Istio/istio-classic/simple/03-hello_world_1_service_2_deployments_managed_version/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/01-namespace.yaml b/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/01-namespace.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/README.md b/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/deployment.yaml b/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/gateway.yaml b/Istio/istio-classic/simple/04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/README.md b/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/deployment.yaml b/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/gateway.yaml b/Istio/istio-classic/simple/05-hello_world_1_Service_Entry/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/simple/README.md b/Istio/istio-classic/simple/README.md old mode 100644 new mode 100755 index 17405cc..baac120 --- a/Istio/istio-classic/simple/README.md +++ b/Istio/istio-classic/simple/README.md @@ -8,17 +8,20 @@ # Examples +ALL NEEDS DOCUMENTATION + +- 01-hello_world_1_service_1_deployment + +- 02-hello_world_1_service_2_deployments_unmanaged + +- 03-hello_world_1_service_2_deployments_managed_version + +- 04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace + +- 05-hello_world_1_Service_Entry -## 01-hello_world_1_service_1_deployment - -## 02-hello_world_1_service_2_deployments_unmanaged - -## 03-hello_world_1_service_2_deployments_managed_version - -## 04-hello_world_1_service_2_deployments_managed_version_defaultnt_namespace - -## 05-hello_world_1_Service_Entry +# TODO do HTTPS ingress diff --git a/Istio/istio-classic/traffic_management/01-2_deployments_method/README.md b/Istio/istio-classic/traffic_management/01-2_deployments_method/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/01-2_deployments_method/deployment.yaml b/Istio/istio-classic/traffic_management/01-2_deployments_method/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/01-2_deployments_method/gateway.yaml b/Istio/istio-classic/traffic_management/01-2_deployments_method/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/README.md b/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/deployment.yaml b/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/gateway.yaml b/Istio/istio-classic/traffic_management/02-DirectResponse-HTTP-Body/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/03-HTTPRewrite/README.md b/Istio/istio-classic/traffic_management/03-HTTPRewrite/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/03-HTTPRewrite/deployment.yaml b/Istio/istio-classic/traffic_management/03-HTTPRewrite/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/03-HTTPRewrite/gateway.yaml b/Istio/istio-classic/traffic_management/03-HTTPRewrite/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/04-HTTPRedirect/README.md b/Istio/istio-classic/traffic_management/04-HTTPRedirect/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/04-HTTPRedirect/deployment.yaml b/Istio/istio-classic/traffic_management/04-HTTPRedirect/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/04-HTTPRedirect/gateway.yaml b/Istio/istio-classic/traffic_management/04-HTTPRedirect/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/README.md b/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/deployment.yaml b/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/gateway.yaml b/Istio/istio-classic/traffic_management/05a-FaultInjection-delay/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/README.md b/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/deployment.yaml b/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/gateway.yaml b/Istio/istio-classic/traffic_management/05b-FaultInjection-abort/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/06-mTLS/README.md b/Istio/istio-classic/traffic_management/06-mTLS/README.md old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/06-mTLS/deployment.yaml b/Istio/istio-classic/traffic_management/06-mTLS/deployment.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/06-mTLS/gateway.yaml b/Istio/istio-classic/traffic_management/06-mTLS/gateway.yaml old mode 100644 new mode 100755 diff --git a/Istio/istio-classic/traffic_management/README.md b/Istio/istio-classic/traffic_management/README.md old mode 100644 new mode 100755 index af3ca86..20c0e28 --- a/Istio/istio-classic/traffic_management/README.md +++ b/Istio/istio-classic/traffic_management/README.md @@ -1,3 +1,8 @@ + + + + + Should try to do a double Virtual Service chain https://academy.tetrate.io/courses/take/istio-fundamentals/lessons/19068816-lab-2-observing-failure-injection diff --git a/Istio/sidecar/01-ingress-proxy-forwarding/README.md b/Istio/sidecar/01-ingress-proxy-forwarding/README.md old mode 100644 new mode 100755 index 2ea94af..9efd6c8 --- a/Istio/sidecar/01-ingress-proxy-forwarding/README.md +++ b/Istio/sidecar/01-ingress-proxy-forwarding/README.md @@ -1,16 +1,12 @@ - - - - # Continues from - 01-hello_world_1_service_1_deployment +# TO TRAFFIC PATH DIAGRAM etc -> "POD" -> sidecar -> service container +# Description - - ---- +This example configures the sidecar proxy on the pods created, to forward the traffic incoming from the port `8080` to the port `80` ## Files @@ -43,9 +39,17 @@ ###### Configuration ```yml -port: 80 -istio-ingress: ingressgateway -hosts: "*" +... +spec: + selector: + istio: ingressgateway # use istio default controller + servers: + - port: + number: 80 + name: http + protocol: HTTP + hosts: + - "*" ``` #### VirtualService @@ -54,19 +58,63 @@ hosts: "*" ###### Configuration +```yaml +... +spec: + hosts: + - "*" + gateways: + - helloworld-gateway + http: + - match: + - uri: + exact: /helloworld + route: + - destination: + host: helloworld.default.svc.cluster.local + port: + number: 8080 + rewrite: + uri: "/" +``` +- On this example, we are using the port `8080` as a destination. + +## sidecar.yaml + +### creates + +#### sidecar + +##### helloworld-sidecar + +###### Configuration ```yaml -hosts: "*" -uri: "/helloworld" -rewrite: - uri: "/" -``` -- Allows the traffic from that have any domain. +... +spec: + workloadSelector: + labels: + app: helloworld + ingress: + - port: + number: 8080 + protocol: HTTP + name: ingressport + defaultEndpoint: 127.0.0.1:80 +```` -- Only allows traffic that has as a destination the directory/path `/helloworld`. +workloadSelector: -- `rewrite.uri` allows to redirect the traffic towards the root directory of the service, as the service(s) used don't have any directory named `helloworld` but are configured to work at the root base level. +> `workloadSelector` is used to target the `PODS`, on which apply this sidecar configuration. \ +> Bear in mind that this configuration doesn't target kinds `Service`, nor `Deployment`, it's applied to a kind `Pod` or `ServiceEntry` \ +> If there is no `workloadSelector` specified, it will be used as default configuration for the namespace on which was created. \ +> More info in the [Istio documentation for workloadSelector](https://istio.io/latest/docs/reference/config/networking/sidecar/#WorkloadSelector) + +ingress: + +> Configure the behavior of the ingress traffic.\ +> On this "grabs"/targets the ingress traffic with port 8080, and forwards it to the port IP `127.0.0.1` (loopback) respective to the destination pod, with the destination port set to 80, which is the port that the service is currently listening to. # Run example @@ -78,16 +126,15 @@ service/helloworld created deployment.apps/helloworld-nginx created gateway.networking.istio.io/helloworld-gateway created virtualservice.networking.istio.io/helloworld-vs created +sidecar.networking.istio.io/helloworld-sidecar created ``` ## Wait for the pods to be ready -(I think it deploys 2 pods as there is the Envoy Proxy pod besides the Nginx deployment) - ```shell $ kubectl get deployment helloworld-nginx -w NAME READY UP-TO-DATE AVAILABLE AGE -helloworld-nginx 1/1 1 1 44s +helloworld-nginx 1/1 1 1 39s ``` ## Test the service @@ -103,6 +150,21 @@ istio-ingressgateway LoadBalancer 10.97.47.216 192.168.1.50 15021:31316/ ### Curl ```shell -$ curl 192.168.1.50/helloworld -s | grep "