Created
July 19, 2019 22:20
-
-
Save mreferre/d081ac264ad4a76062ce4be25296125f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This should work on Kubernetes deployments on AWS that have an ALB ingress controller as well as App Mesh components deployed. | |
apiVersion: appmesh.k8s.aws/v1beta1 | |
kind: Mesh | |
metadata: | |
name: MESH_NAME | |
--- | |
apiVersion: appmesh.k8s.aws/v1beta1 | |
kind: VirtualNode | |
metadata: | |
name: nginx-v1 | |
spec: | |
meshName: MESH_NAME | |
listeners: | |
- portMapping: | |
port: 80 | |
protocol: http | |
serviceDiscovery: | |
dns: | |
hostName: nginx1-v1 | |
backends: | |
- virtualService: | |
virtualServiceName: nginx2 | |
--- | |
apiVersion: appmesh.k8s.aws/v1beta1 | |
kind: VirtualNode | |
metadata: | |
name: nginx-v2 | |
spec: | |
meshName: MESH_NAME | |
listeners: | |
- portMapping: | |
port: 80 | |
protocol: http | |
serviceDiscovery: | |
dns: | |
hostName: nginx1-v2 | |
backends: | |
- virtualService: | |
virtualServiceName: nginx1 | |
--- | |
apiVersion: appmesh.k8s.aws/v1beta1 | |
kind: VirtualService | |
metadata: | |
name: nginx1 | |
spec: | |
meshName: MESH_NAME | |
routes: | |
- name: nginx1-route | |
http: | |
match: | |
prefix: / | |
action: | |
weightedTargets: | |
- virtualNodeName: nginx-v1 | |
weight: 1 | |
--- | |
apiVersion: appmesh.k8s.aws/v1beta1 | |
kind: VirtualService | |
metadata: | |
name: nginx2 | |
spec: | |
meshName: MESH_NAME | |
routes: | |
- name: nginx2-route | |
http: | |
match: | |
prefix: / | |
action: | |
weightedTargets: | |
- virtualNodeName: nginx-v2 | |
weight: 1 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx1 | |
spec: | |
ports: | |
- port: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx2 | |
spec: | |
ports: | |
- port: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx1-v1 | |
labels: | |
app: nginx1-v1-app | |
spec: | |
type: ClusterIP | |
ports: | |
- port: 80 | |
selector: | |
app: nginx1-v1-app | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx2-v1 | |
labels: | |
app: nginx2-v1-app | |
spec: | |
type: ClusterIP | |
ports: | |
- port: 80 | |
selector: | |
app: nginx2-v1-app | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: nginx1-v1-deployment | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: nginx1-v1-app | |
spec: | |
containers: | |
- name: nginx1-v1-container | |
image: nginx | |
ports: | |
- containerPort: 80 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: nginx2-v1-deployment | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: nginx2-v1-app | |
spec: | |
containers: | |
- name: nginx2-v1-container | |
image: amazonlinux:2 | |
command: ["/bin/bash", "-ec", "while :; do echo '.'; sleep 5 ; done"] | |
ports: | |
- containerPort: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment