Skip to content

Instantly share code, notes, and snippets.

@kmassada
Last active September 26, 2018 18:29
Show Gist options
  • Save kmassada/e382070ebacedbe322863c92815d2289 to your computer and use it in GitHub Desktop.
Save kmassada/e382070ebacedbe322863c92815d2289 to your computer and use it in GitHub Desktop.
fanout ingress with static IP

create static IP

gcloud compute addresses create fanout-ingress --region $REGION

Note annotation "fanout-gress" is the name of static IP

  annotations:
    kubernetes.io/ingress.global-static-ip-name: fanout-ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: fanout-ingress-gce
annotations:
kubernetes.io/ingress.global-static-ip-name: fanout-ingress
spec:
rules:
- http:
paths:
- path: /app1/*
backend:
serviceName: nginx-service
servicePort: 80
- path: /app2/*
backend:
serviceName: httpd-service
servicePort: 80
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: nginx-service
spec:
type: NodePort
selector:
app: nginx
ports:
- protocol: TCP
port: 80
protocol: TCP
name: http
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: httpd-deployment
labels:
app: httpd
spec:
replicas: 1
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: httpd
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: httpd-service
spec:
type: NodePort
selector:
app: httpd
ports:
- protocol: TCP
port: 80
protocol: TCP
name: http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment