kubernetes部署livego直播服务
https://www.peacher.cn/index.php/archives/123/
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations: {}
labels:
k8s.kuboard.cn/name: livego
name: livego
namespace: sre
spec:
replicas: 1
selector:
matchLabels:
k8s.kuboard.cn/name: livego
template:
metadata:
creationTimestamp: null
labels:
k8s.kuboard.cn/name: livego
spec:
containers:
- image: gwuhaolin/livego
imagePullPolicy: Always
name: livego
ports:
- containerPort: 1935
name: rtmp-play
protocol: TCP
- containerPort: 7001
name: flv-play
protocol: TCP
- containerPort: 7002
name: hls-play
protocol: TCP
- containerPort: 8090
name: api
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
annotations: {}
labels:
k8s.kuboard.cn/name: livego
name: livego
namespace: sre
spec:
ports:
- name: api
nodePort: 30001
port: 8090
protocol: TCP
targetPort: 8090
- name: live
nodePort: 30016
port: 1935
protocol: TCP
targetPort: 1935
- name: flv
nodePort: 30017
port: 7001
protocol: TCP
targetPort: 7001
- name: hraziw
nodePort: 30018
port: 7002
protocol: TCP
targetPort: 7002
selector:
k8s.kuboard.cn/name: livego
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
type: NodePort
访问 http://172.16.0.17:30001/control/get?room=movie
获取推流的channelkey 其中movie
是自定义的房间号
{"status":200,"data":"rfBd56ti2SMtYvSgD5xAV0YU99zampta7Z7S575KLkIZ9PYk"}
OBS推流
rtmp://172.16.0.17:30016/live
rfBd56ti2SMtYvSgD5xAV0YU99zampta7Z7S575KLkIZ9PYk
播放地址如下:
RTMP:rtmp://172.16.0.17:30016/live/movie
HLS:http://172.16.0.17:30018/live/movie.m3u8
FLV:http://172.16.0.17:30017/live/movie.flv