Skip to content

Instantly share code, notes, and snippets.

@C1aud3
Last active February 28, 2023 17:43
Show Gist options
  • Save C1aud3/2280b5a87fc210782c8b9cb8cc38b4aa to your computer and use it in GitHub Desktop.
Save C1aud3/2280b5a87fc210782c8b9cb8cc38b4aa to your computer and use it in GitHub Desktop.
Echo Service with an Ingress handled by Kong
apiVersion: v1
kind: Service
metadata:
labels:
app: echo
name: echo
namespace: primavera
annotations:
ingress.kubernetes.io/service-upstream: "true"
spec:
ports:
- port: 8080
name: high
protocol: TCP
targetPort: 8080
- port: 80
name: low
protocol: TCP
targetPort: 8080
selector:
app: echo
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: echo
name: echo
namespace: primavera
spec:
replicas: 1
selector:
matchLabels:
app: echo
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: echo
annotations:
kuma.io/mesh: default
spec:
containers:
- image: gcr.io/kubernetes-e2e-test-images/echoserver:2.2
name: echo
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
resources: {}
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: echo-primavera-api
annotations:
kubernetes.io/ingress.class: kong
kubernetes.io/ingress.allow-http: "true"
namespace: primavera
spec:
rules:
- host: "echo-primavera-api.np.platform.telus.digital"
http:
paths:
- backend:
serviceName: echo
servicePort: 80
---
@C1aud3
Copy link
Author

C1aud3 commented Sep 28, 2020

  • Please do not use the default Kubernetes namespace to deploy your artifacts. Use the primavera namespace instead.
  • The GKE cluster comes installed with Kuma in Standalone Mode for simplicity's sake (vs Multi-Zone mode).
  • You shouldn't have to bother with Kuma for the POC, but please use the kuma.io/mesh: default annotation on your Deployment's Pod template. That will automatically onboard your service on the default mesh.
  • The ingress.kubernetes.io/service-upstream: "true" basically tells Kong to let Kuma handle the Load Balancing and enables Kuma to apply policies.
  • The kubernetes.io/ingress.class: kong explicitly tells that your Ingress should be handled by Kong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment