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 |