apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 targetPort: 80 protocol: TCP name: http 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: http-svc labels: app: http-svc spec: ports: - port: 80 targetPort: 8080 protocol: TCP name: http selector: app: http-svc --- apiVersion: v1 kind: ReplicationController metadata: name: http-svc spec: replicas: 1 template: metadata: labels: app: http-svc spec: containers: - name: http-svc image: gcr.io/google_containers/echoserver:1.8 ports: - containerPort: 8080 env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: foo-tls namespace: default spec: tls: - hosts: - foo.bar.com # This secret must exist beforehand # The cert must also contain the subj-name foo.bar.com # You can create it via: # make keys secret SECRET=/tmp/foobar.json HOST=foo.bar.com NAME=foobar # https://github.com/kubernetes/ingress/tree/master/controllers/gce/examples/https secretName: foobar - hosts: - bar.baz.com # This secret must exist beforehand # The cert must also contain the subj-name bar.baz.com # You can create it via: # make keys secret SECRET=/tmp/barbaz.json HOST=bar.baz.com NAME=barbaz # https://github.com/kubernetes/ingress/tree/master/controllers/gce/examples/https secretName: barbaz rules: - host: foo.bar.com http: paths: - backend: serviceName: http-svc servicePort: 80 path: / - host: bar.baz.com http: paths: - backend: serviceName: nginx servicePort: 80 path: /