Skip to content

Instantly share code, notes, and snippets.

@bprashanth
Created April 7, 2016 22:49
Show Gist options
  • Save bprashanth/9721725f06fe5a9fdc366baf97dd297e to your computer and use it in GitHub Desktop.
Save bprashanth/9721725f06fe5a9fdc366baf97dd297e to your computer and use it in GitHub Desktop.
ing.md
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    app: nginx
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: gcr.io/google_containers/nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: echoheadersx
  labels:
    app: echoheaders
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30301
    targetPort: 8080
    protocol: TCP
    name: http
  selector:
    app: echoheaders
---
apiVersion: v1
kind: Service
metadata:
  name: echoheadersdefault
  labels:
    app: echoheaders
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30302
    targetPort: 8080
    protocol: TCP
    name: http
  selector:
    app: echoheaders
---
apiVersion: v1
kind: Service
metadata:
  name: echoheadersy
  labels:
    app: echoheaders
spec:
  type: NodePort
  ports:
  - port: 80
    nodePort: 30284
    targetPort: 8080
    protocol: TCP
    name: http
  selector:
    app: echoheaders
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: echoheaders
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: echoheaders
    spec:
      containers:
      - name: echoheaders
        image: bprashanth/echoserver:0.0
        ports:
        - containerPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: echomap2
spec:
  backend:
    serviceName: echoheadersdefault
    servicePort: 80
  rules:
  - host: foo.bar.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: nginx
          servicePort:  80
      - path: /foo
        backend:
          serviceName: echoheadersx
          servicePort: 80
      - path: /foo/bar
        backend:
          serviceName: nginx
          servicePort: 80
  - host: bar.baz.com
    http:
      paths:
      - path: /bar
        backend:
          serviceName: echoheadersy
          servicePort: 80
      - path: /foo
        backend:
          serviceName: echoheadersx
          servicePort: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment