Skip to content

Instantly share code, notes, and snippets.

@jfblaine
Last active May 14, 2020 12:48
Show Gist options
  • Select an option

  • Save jfblaine/007ab38c14b5a481e84e9cfb8e617a60 to your computer and use it in GitHub Desktop.

Select an option

Save jfblaine/007ab38c14b5a481e84e9cfb8e617a60 to your computer and use it in GitHub Desktop.
Istio url rewrite example
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello
version: v1
name: hello
namespace: istio-test
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: hello
version: v1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: hello
version: v1
annotations:
sidecar.istio.io/inject: "true"
spec:
containers:
- image: registry.redhat.io/rhscl/httpd-24-rhel7@sha256:950af0b156f39634673132241dc3dacb063c12e2cba0abf0d7406c04036aa7f9
imagePullPolicy: IfNotPresent
name: httpd
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8443
protocol: TCP
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
labels:
app: hello
name: hello-gateway
namespace: istio-test
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: v1
kind: Service
metadata:
labels:
app: hello
service: hello
name: hello
namespace: istio-test
spec:
ports:
- name: http
port: 8080
selector:
app: hello
sessionAffinity: None
type: ClusterIP
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
labels:
app: hello
name: hello
namespace: istio-test
spec:
gateways:
- hello-gateway
hosts:
- "*"
http:
- match:
- uri:
prefix: "/config-server/"
- uri:
prefix: "/config-server"
rewrite:
uri: "/"
route:
- destination:
host: hello
port:
number: 8080
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
labels:
app: hello
name: hello
namespace: istio-test
spec:
host: hello
subsets:
- name: v1
labels:
version: v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment