Skip to content

Instantly share code, notes, and snippets.

@denniswebb
Last active October 7, 2019 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denniswebb/23957c9bf11fa9fa856fe2b8f0557ab1 to your computer and use it in GitHub Desktop.
Save denniswebb/23957c9bf11fa9fa856fe2b8f0557ab1 to your computer and use it in GitHub Desktop.
# Prepare cluster
# helm install --name cert-manager --namespace=cert-manager jetstack/cert-manager --version v0.10.1
# kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true
# kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.10.1/cert-manager.yaml
# helm install istio.io/istio-init --name istio-init --namespace istio-system
# helm install istio.io/istio --name istio --namespace istio-system --set-string gateways.istio-ingressgateway.sds.enabled=true
# kubectl label ns default istio-injection=enabled
apiVersion: v1
kind: Service
metadata:
name: httpbin
namespace: default
labels:
app: httpbin
spec:
ports:
- name: http
port: 8000
targetPort: 80
selector:
app: httpbin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: httpbin
version: v1
template:
metadata:
labels:
app: httpbin
version: v1
spec:
containers:
- image: docker.io/kennethreitz/httpbin
imagePullPolicy: IfNotPresent
name: httpbin
ports:
- containerPort: 80
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
name: selfsigning-issuer
spec:
selfSigned: {}
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: httpbin.test
namespace: istio-system
spec:
secretName: httpbin.test
issuerRef:
name: selfsigning-issuer
kind: ClusterIssuer
commonName: httpbin.test
dnsNames:
- httpbin.test
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: httpbin
namespace: default
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- httpbin.test
port:
name: https-httpbin
number: 443
protocol: HTTPS
tls:
credentialName: httpbin.test
mode: SIMPLE
privateKey: sds
serverCertificate: sds
- hosts:
- httpbin.test
port:
name: http-httpbin
number: 80
protocol: HTTP
tls:
httpsRedirect: true
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: httpbin
namespace: default
spec:
gateways:
- httpbin
hosts:
- httpbin.test
http:
- corsPolicy:
allowOrigin:
- '*'
route:
- destination:
host: httpbin
port:
number: 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment