Skip to content

Commit

Permalink
Add k8s yamls
Browse files Browse the repository at this point in the history
  • Loading branch information
bgelov committed Jul 6, 2023
1 parent fa4d84b commit 9f91f75
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 0 deletions.
22 changes: 22 additions & 0 deletions xiu-autoscaller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: xiu-prod-autoscaling
namespace: xiu-prod-namespace
labels:
app: xiu
environment: prod
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: xiu-prod-deployment
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 1
24 changes: 24 additions & 0 deletions xiu-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: xiu-node-configmap
namespace: xiu-prod-namespace
labels:
app: xiu
environment: prod
data:
config_rtmp.toml: |
[rtmp]
enabled = true
port = 1935
[hls]
enabled = true
port = 8080
[httpflv]
enabled = true
port = 8081
[log]
level = "info"
57 changes: 57 additions & 0 deletions xiu-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: xiu-prod-deployment
namespace: xiu-prod-namespace
labels:
app: xiu
environment: prod
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: xiu
environment: prod
template:
metadata:
labels:
app: xiu
environment: prod
spec:
containers:
- name: xiu-prod-pod
image: bgelov/1687346100-977d03e7f0746077d90baa216bbf61c2:1.0.0
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 1935
- containerPort: 8080
- containerPort: 8081
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 10
periodSeconds: 30
volumeMounts:
- name: config
mountPath: "/etc/xiu"
readOnly: true
volumes:
- name: config
configMap:
name: xiu-node-configmap
items:
- key: "config_rtmp.toml"
path: "config_rtmp.toml"
42 changes: 42 additions & 0 deletions xiu-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: xiu-prod-ingress
namespace: xiu-prod-namespace
labels:
app: xiu
environment: prod
annotations:
# https://cloud.yandex.ru/docs/managed-kubernetes/tutorials/new-kubernetes-project
ingress.alb.yc.io/subnets: xxxxxxxxxxxxxxxxxxxx
ingress.alb.yc.io/external-ipv4-address: auto
ingress.alb.yc.io/group-name: xiu-prod-ingress
spec:
tls:
- hosts:
- hls.vestan.ip03.ru
secretName: yc-certmgr-cert-id-xxxxxxxxxxxxxxxxxxxx
- hosts:
- httpflv.vestan.ip03.ru
secretName: yc-certmgr-cert-id-xxxxxxxxxxxxxxxxxxxx
rules:
- host: hls.vestan.ip03.ru
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: xiu-prod-service
port:
name: hls
- host: httpflv.vestan.ip03.ru
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: xiu-prod-service
port:
name: httpflv
7 changes: 7 additions & 0 deletions xiu-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: xiu-prod-namespace
labels:
app: xiu
environment: prod
21 changes: 21 additions & 0 deletions xiu-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: xiu-prod-service
namespace: xiu-prod-namespace
labels:
app: xiu
environment: prod
spec:
selector:
app: xiu-prod-pod
ports:
- name: hls
port: 8080
targetPort: 8080
- name: httpflv
port: 8081
targetPort: 8081
- name: rtmp
port: 1935
targetPort: 1935

0 comments on commit 9f91f75

Please sign in to comment.