Skip to content

Commit 2488327

Browse files
committed
Welcome to StackSimplify
1 parent 87d5866 commit 2488327

20 files changed

+542
-72
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: fp-dev
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app1-nginx-deployment
5+
labels:
6+
app: app1-nginx
7+
namespace: fp-dev
8+
spec:
9+
replicas: 2
10+
selector:
11+
matchLabels:
12+
app: app1-nginx
13+
template:
14+
metadata:
15+
labels:
16+
app: app1-nginx
17+
spec:
18+
containers:
19+
- name: app1-nginx
20+
image: stacksimplify/kube-nginxapp1:1.0.0
21+
ports:
22+
- containerPort: 80
23+
resources:
24+
requests:
25+
memory: "128Mi"
26+
cpu: "500m"
27+
limits:
28+
memory: "500Mi"
29+
cpu: "1000m"
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: app1-nginx-nodeport-service
35+
labels:
36+
app: app1-nginx
37+
namespace: fp-dev
38+
annotations:
39+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
40+
alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
41+
spec:
42+
type: NodePort
43+
selector:
44+
app: app1-nginx
45+
ports:
46+
- port: 80
47+
targetPort: 80
48+
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Annotations Reference: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/
2+
apiVersion: extensions/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: ingress-usermgmt-restapp-service
6+
labels:
7+
app: usermgmt-restapp
8+
namespace: fp-dev
9+
annotations:
10+
# Ingress Core Settings
11+
kubernetes.io/ingress.class: "alb"
12+
alb.ingress.kubernetes.io/scheme: internet-facing
13+
# Health Check Settings
14+
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
15+
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
16+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
17+
#alb.ingress.kubernetes.io/healthcheck-path: /usermgmt/health-status
18+
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
19+
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
20+
alb.ingress.kubernetes.io/success-codes: '200'
21+
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
22+
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
23+
## SSL Settings
24+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
25+
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:180789647333:certificate/9f042b5d-86fd-4fad-96d0-c81c5abc71e1
26+
#alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01 #Optional (Picks default if not used)
27+
# SSL Redirect Setting
28+
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
29+
# External DNS - For creating a Record Set in Route53
30+
external-dns.alpha.kubernetes.io/hostname: fpdev.kubeoncloud.com
31+
# For Fargate
32+
alb.ingress.kubernetes.io/target-type: ip
33+
spec:
34+
rules:
35+
- http:
36+
paths:
37+
- path: /* # SSL Redirect Setting
38+
backend:
39+
serviceName: ssl-redirect
40+
servicePort: use-annotation
41+
- path: /*
42+
backend:
43+
serviceName: app1-nginx-nodeport-service
44+
servicePort: 80
45+
# Important Note-1: In path based routing order is very important, if we are going to use "/*", try to use it at the end of all rules.
46+
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
# Annotations Reference: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/
2-
apiVersion: extensions/v1beta1
1+
# Annotations Reference: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/
2+
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
name: ingress-usermgmt-restapp-service
6-
labels:
7-
app: usermgmt-restapp
5+
name: app1-ingress-service
86
namespace: fp-dev
97
annotations:
8+
# Load Balancer Name
9+
alb.ingress.kubernetes.io/load-balancer-name: ingress-fargatedemo
1010
# Ingress Core Settings
11-
kubernetes.io/ingress.class: "alb"
11+
#kubernetes.io/ingress.class: "alb" (OLD INGRESS CLASS NOTATION - STILL WORKS BUT RECOMMENDED TO USE IngressClass Resource)
1212
alb.ingress.kubernetes.io/scheme: internet-facing
1313
# Health Check Settings
1414
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
1515
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
1616
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
17-
#alb.ingress.kubernetes.io/healthcheck-path: /usermgmt/health-status
1817
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
1918
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
2019
alb.ingress.kubernetes.io/success-codes: '200'
2120
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
22-
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
21+
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
2322
## SSL Settings
2423
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
25-
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:180789647333:certificate/9f042b5d-86fd-4fad-96d0-c81c5abc71e1
24+
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:180789647333:certificate/d86de939-8ffd-410f-adce-0ce1f5be6e0d
2625
#alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01 #Optional (Picks default if not used)
2726
# SSL Redirect Setting
28-
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
27+
alb.ingress.kubernetes.io/ssl-redirect: '443'
2928
# External DNS - For creating a Record Set in Route53
30-
external-dns.alpha.kubernetes.io/hostname: fpdev.kubeoncloud.com
29+
external-dns.alpha.kubernetes.io/hostname: fpdev101.stacksimplify.com
3130
# For Fargate
3231
alb.ingress.kubernetes.io/target-type: ip
3332
spec:
3433
rules:
3534
- http:
36-
paths:
37-
- path: /* # SSL Redirect Setting
35+
paths:
36+
- path: /app1
37+
pathType: Prefix
3838
backend:
39-
serviceName: ssl-redirect
40-
servicePort: use-annotation
41-
- path: /*
42-
backend:
43-
serviceName: app1-nginx-nodeport-service
44-
servicePort: 80
39+
service:
40+
name: app1-nginx-nodeport-service
41+
port:
42+
number: 80
4543
# Important Note-1: In path based routing order is very important, if we are going to use "/*", try to use it at the end of all rules.
4644

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: eksctl.io/v1alpha5
2+
kind: ClusterConfig
3+
metadata:
4+
name: eksdemo1 # Name of the EKS Cluster
5+
region: us-east-1
6+
fargateProfiles:
7+
- name: fp-app2
8+
selectors:
9+
# All workloads in the "ns-app2" Kubernetes namespace will be
10+
# scheduled onto Fargate:
11+
- namespace: ns-app2
12+
- name: fp-ums
13+
selectors:
14+
# All workloads in the "ns-ums" Kubernetes namespace matching the following
15+
# label selectors will be scheduled onto Fargate:
16+
- namespace: ns-ums
17+
labels:
18+
runon: fargate
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: ns-app1
5+
# Apps deployed in this namespace will run on a EC2 Managed Node Group
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app1-nginx-deployment
5+
labels:
6+
app: app1-nginx
7+
namespace: ns-app1
8+
spec:
9+
replicas: 2
10+
selector:
11+
matchLabels:
12+
app: app1-nginx
13+
template:
14+
metadata:
15+
labels:
16+
app: app1-nginx
17+
spec:
18+
containers:
19+
- name: app1-nginx
20+
image: stacksimplify/kube-nginxapp1:1.0.0
21+
ports:
22+
- containerPort: 80
23+
resources:
24+
requests:
25+
memory: "128Mi"
26+
cpu: "500m"
27+
limits:
28+
memory: "500Mi"
29+
cpu: "1000m"
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: app1-nginx-nodeport-service
35+
labels:
36+
app: app1-nginx
37+
namespace: ns-app1
38+
annotations:
39+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
40+
alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
41+
spec:
42+
type: NodePort
43+
selector:
44+
app: app1-nginx
45+
ports:
46+
- port: 80
47+
targetPort: 80
48+
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Annotations Reference: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/
2+
apiVersion: extensions/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: app1-ingress-service
6+
labels:
7+
app: app1-nginx
8+
namespace: ns-app1
9+
annotations:
10+
# Ingress Core Settings
11+
kubernetes.io/ingress.class: "alb"
12+
alb.ingress.kubernetes.io/scheme: internet-facing
13+
# Health Check Settings
14+
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
15+
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
16+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
17+
#alb.ingress.kubernetes.io/healthcheck-path: /usermgmt/health-status
18+
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
19+
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
20+
alb.ingress.kubernetes.io/success-codes: '200'
21+
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
22+
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
23+
## SSL Settings
24+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
25+
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:180789647333:certificate/9f042b5d-86fd-4fad-96d0-c81c5abc71e1
26+
#alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01 #Optional (Picks default if not used)
27+
# SSL Redirect Setting
28+
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
29+
# External DNS - For creating a Record Set in Route53
30+
external-dns.alpha.kubernetes.io/hostname: app1.kubeoncloud.com
31+
spec:
32+
rules:
33+
- http:
34+
paths:
35+
- path: /* # SSL Redirect Setting
36+
backend:
37+
serviceName: ssl-redirect
38+
servicePort: use-annotation
39+
- path: /*
40+
backend:
41+
serviceName: app1-nginx-nodeport-service
42+
servicePort: 80
43+
# Important Note-1: In path based routing order is very important, if we are going to use "/*", try to use it at the end of all rules.
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: ns-app2
5+
# Apps deployed in this namespace will run on a Fargate fp-app2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app2-nginx-deployment
5+
labels:
6+
app: app2-nginx
7+
namespace: ns-app2
8+
spec:
9+
replicas: 2
10+
selector:
11+
matchLabels:
12+
app: app2-nginx
13+
template:
14+
metadata:
15+
labels:
16+
app: app2-nginx
17+
spec:
18+
containers:
19+
- name: app2-nginx
20+
image: stacksimplify/kube-nginxapp2:1.0.0
21+
ports:
22+
- containerPort: 80
23+
resources:
24+
requests:
25+
memory: "128Mi"
26+
cpu: "500m"
27+
limits:
28+
memory: "500Mi"
29+
cpu: "1000m"
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: app2-nginx-nodeport-service
35+
labels:
36+
app: app2-nginx
37+
namespace: ns-app2
38+
annotations:
39+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
40+
alb.ingress.kubernetes.io/healthcheck-path: /app2/index.html
41+
# For Fargate
42+
alb.ingress.kubernetes.io/target-type: ip
43+
spec:
44+
type: NodePort
45+
selector:
46+
app: app2-nginx
47+
ports:
48+
- port: 80
49+
targetPort: 80
50+
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Annotations Reference: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/
2+
apiVersion: extensions/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: app2-ingress-service
6+
labels:
7+
app: app2-nginx
8+
namespace: ns-app2
9+
annotations:
10+
# Ingress Core Settings
11+
kubernetes.io/ingress.class: "alb"
12+
alb.ingress.kubernetes.io/scheme: internet-facing
13+
# Health Check Settings
14+
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
15+
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
16+
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
17+
#alb.ingress.kubernetes.io/healthcheck-path: /usermgmt/health-status
18+
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
19+
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
20+
alb.ingress.kubernetes.io/success-codes: '200'
21+
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
22+
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
23+
## SSL Settings
24+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
25+
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:180789647333:certificate/9f042b5d-86fd-4fad-96d0-c81c5abc71e1
26+
#alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01 #Optional (Picks default if not used)
27+
# SSL Redirect Setting
28+
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
29+
# External DNS - For creating a Record Set in Route53
30+
external-dns.alpha.kubernetes.io/hostname: app2.kubeoncloud.com
31+
# For Fargate
32+
alb.ingress.kubernetes.io/target-type: ip
33+
spec:
34+
rules:
35+
- http:
36+
paths:
37+
- path: /* # SSL Redirect Setting
38+
backend:
39+
serviceName: ssl-redirect
40+
servicePort: use-annotation
41+
- path: /*
42+
backend:
43+
serviceName: app2-nginx-nodeport-service
44+
servicePort: 80
45+
# Important Note-1: In path based routing order is very important, if we are going to use "/*", try to use it at the end of all rules.
46+

0 commit comments

Comments
 (0)