2022-04-03:k8s安装srs,yaml如何写?

答案2022-04-03:

yaml如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: srs
  name: srs
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: srs
  template:
    metadata:
      labels:
        app: srs
    spec:
      containers:
        - image: ossrs/srs
          imagePullPolicy: IfNotPresent
          name: srs
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: srs
  name: srs
  namespace: moonfdd
spec:
  ports:
    - name: rtmp
      port: 1935
      protocol: TCP
      targetPort: 1935
      nodePort: 11935
    - name: console
      port: 1985
      protocol: TCP
      targetPort: 1985
      nodePort: 11985
    - name: stream
      port: 8080
      protocol: TCP
      targetPort: 8080
      nodePort: 18080
  selector:
    app: srs
  type: NodePort

结果如下:

在这里插入图片描述 在这里插入图片描述