Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Kubernetes and Istio manifests needed to get my app running within an…
Browse files Browse the repository at this point in the history
… Istio service mesh.

* `ctmd.yml` is the main k8s manifest for the app. `istioctl kube-inject` is used to inject Istio sidecars etc when the manifest is written into a k8s cluster.
* `ctmd-mongo-egress.yml` defines a basic Istio egress rule, allowing my app to talk to an external mongo cluster
* `gateway.yml` opens an ingress into my service mesh, allowing http traffic to hit my service

See https://morganpeat.github.io/microservices/2018/08/30/cryptotracker-d.html
  • Loading branch information
Morgan Peat committed Aug 30, 2018
1 parent 8ccd728 commit 45958c9
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ctmd-mongo-egress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: mongo-ext
spec:
hosts:
- ignored-as-not-http.com
addresses:
- 0.0.0.0/0
ports:
- number: 27017
name: mongo
protocol: MONGO
location: MESH_EXTERNAL
resolution: NONE

41 changes: 41 additions & 0 deletions ctmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##################################################################################################
# Market Data service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: marketdata
labels:
app: marketdata
spec:
ports:
- port: 80
name: http
targetPort: 8080
selector:
app: marketdata
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: marketdata-v1
spec:
replicas: 1
template:
metadata:
labels:
app: marketdata
version : 1
spec:
containers:
- name: marketdata
image: morganpeat/cryptotracker
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: MongoDB__ConnectionString
valueFrom:
secretKeyRef:
key: MongoDB__ConnectionString
name: ctmd-config
33 changes: 33 additions & 0 deletions gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: ctmd-gateway
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ctmd
spec:
hosts:
- "*"
gateways:
- ctmd-gateway
http:
- match:
- uri:
prefix: /api
route:
- destination:
port:
number: 80
host: marketdata

0 comments on commit 45958c9

Please sign in to comment.