backup, need to fill READMEs
This commit is contained in:
parent
233c855fc1
commit
4ef69ba81e
@ -13,6 +13,8 @@ Through rewriting the URI we can point to the root directory from nginx.
|
||||
uri: "/"
|
||||
```
|
||||
|
||||
## The idea is that this rewrite is handled "internally" by Istio, not by the Client that started the request
|
||||
|
||||
|
||||
## Practical usages:
|
||||
|
||||
|
@ -0,0 +1,61 @@
|
||||
|
||||
|
||||
# Continues from
|
||||
|
||||
- 01-hello_world_1_service_1_deployment
|
||||
|
||||
|
||||
|
||||
https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRedirect
|
||||
|
||||
## The idea is that this rewrite is handled "externally" by the client, not by Istio.
|
||||
|
||||
|
||||
|
||||
## Practical examples
|
||||
|
||||
|
||||
### HTTP to HTTPS redirect.
|
||||
|
||||
The following Virtual Service configuration will redirect all the incoming traffic from the gateway `my-gateway` that uses the http protocol, to the https protocol.
|
||||
|
||||
In this example, it would forward all the `http` traffic without taking into account which port is used.
|
||||
|
||||
```
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: to-https-vs
|
||||
spec:
|
||||
hosts:
|
||||
- "*"
|
||||
gateways:
|
||||
- my-gateway
|
||||
http:
|
||||
- match:
|
||||
- name: to_https
|
||||
match:
|
||||
scheme: http
|
||||
redirect:
|
||||
scheme: https
|
||||
```
|
||||
|
||||
### Migrated from a domain
|
||||
|
||||
The following will update the requests coming "to" the domain `old.domain.com` and rewrite the URL to use the "new" `new.domain.com`
|
||||
|
||||
```yaml
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: update-domain-vs
|
||||
spec:
|
||||
hosts:
|
||||
- "old.domain.com"
|
||||
gateways:
|
||||
- helloworld-gateway
|
||||
http:
|
||||
- name: forward-to-new-domain
|
||||
redirect:
|
||||
authority: "new.domain.com"
|
||||
```
|
@ -0,0 +1,40 @@
|
||||
# https://github.com/istio/istio/blob/master/samples/helloworld/helloworld.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: helloworld
|
||||
labels:
|
||||
app: helloworld
|
||||
service: helloworld
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
name: http
|
||||
selector:
|
||||
app: helloworld
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: helloworld-nginx
|
||||
labels:
|
||||
app: helloworld
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: helloworld
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: helloworld
|
||||
spec:
|
||||
containers:
|
||||
- name: helloworld
|
||||
image: nginx
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
imagePullPolicy: IfNotPresent #Always
|
||||
ports:
|
||||
- containerPort: 80
|
@ -0,0 +1,58 @@
|
||||
# https://github.com/istio/istio/blob/master/samples/helloworld/helloworld-gateway.yaml
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: helloworld-gateway
|
||||
spec:
|
||||
selector:
|
||||
istio: ingressgateway # use istio default controller
|
||||
servers:
|
||||
- port:
|
||||
number: 80
|
||||
name: http
|
||||
protocol: HTTP
|
||||
hosts:
|
||||
- "*"
|
||||
---
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: helloworld-vs
|
||||
spec:
|
||||
hosts:
|
||||
- "*"
|
||||
gateways:
|
||||
- helloworld-gateway
|
||||
http:
|
||||
- match:
|
||||
- uri:
|
||||
exact: /helloworld
|
||||
route:
|
||||
- destination:
|
||||
host: helloworld.default.svc.cluster.local
|
||||
port:
|
||||
number: 80
|
||||
rewrite:
|
||||
uri: "/"
|
||||
- name: to_https
|
||||
match:
|
||||
- uri:
|
||||
exact: /https
|
||||
scheme: http
|
||||
redirect:
|
||||
scheme: "https"
|
||||
- name: wikipedia
|
||||
match:
|
||||
- uri:
|
||||
exact: "/wiki"
|
||||
redirect:
|
||||
uri: "/"
|
||||
scheme: "https"
|
||||
authority: "en.wikipedia.org"
|
||||
- name: wikipedia_search
|
||||
match:
|
||||
- uri:
|
||||
prefix: "/wiki/"
|
||||
redirect:
|
||||
scheme: "https"
|
||||
authority: "en.wikipedia.org"
|
Loading…
x
Reference in New Issue
Block a user