Skip to content

Commit

Permalink
Added kubernetes services.
Browse files Browse the repository at this point in the history
  • Loading branch information
h3nryc0ding committed Dec 23, 2023
1 parent 0525a8e commit 41bbedb
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
38 changes: 38 additions & 0 deletions backend-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: service1
spec:
replicas: 2
selector:
matchLabels:
app: service1
template:
metadata:
labels:
app: service1
spec:
containers:
- name: service1
image: ghcr.io/h3nryc0ding/microk8s_plaground:backend
ports:
- name: http
containerPort: 80
imagePullSecrets:
- name: ghcr-secret
nodeSelector:
kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: service1
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: service1
type: ClusterIP
38 changes: 38 additions & 0 deletions frontend-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: service1
spec:
replicas: 2
selector:
matchLabels:
app: service1
template:
metadata:
labels:
app: service1
spec:
containers:
- name: service1
image: ghcr.io/h3nryc0ding/microk8s_plaground:frontend
ports:
- name: http
containerPort: 80
imagePullSecrets:
- name: ghcr-secret
nodeSelector:
kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: service1
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: service1
type: ClusterIP
51 changes: 51 additions & 0 deletions ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress-microk8s
labels:
app: nginx-ingress-microk8s
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-forwarded-headers: "true"
spec:
rules:
- host: "site.com"
http:
paths:
- pathType: Prefix
path: "/(.*)"
backend:
service:
name: service1
port:
number: 80
- host: "api.site.com"
http:
paths:
- pathType: Prefix
path: "/(.*)"
backend:
service:
name: service2
port:
number: 80
---
apiVersion: v1
kind: Service
metadata:
name: ingress
namespace: ingress
spec:
selector:
name: nginx-ingress-microk8s
type: LoadBalancer
loadBalancerIP: 130.61.237.219
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: https
protocol: TCP
port: 443
targetPort: 443

0 comments on commit 41bbedb

Please sign in to comment.