- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.6k
Closed
Labels
FeatureIt's a new feature.It's a new feature.KubernetesFor K8s, Prometheus, APM and Grafana.For K8s, Prometheus, APM and Grafana.TransByAITranslated by AI/GPT.Translated by AI/GPT.
Milestone
Description
K8S uses ConfigMap to store configuration files, for example:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: srs-config
data:
  srs.conf: |-
    listen              1935;
    max_connections     1000;
    daemon              off;
    http_api {
        enabled         on;
        listen          1985;
    }
    http_server {
        enabled         on;
        listen          8080;
    }
    vhost __defaultVhost__ {
        http_remux {
            enabled     on;
        }
        hls {
            enabled         on;
        }
    }
EOFConfigMap will be mounted as a volume and become a configuration file:
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: srs-deploy
  labels:
    app: srs
spec:
  replicas: 1
  selector:
    matchLabels:
      app: srs
  template:
    metadata:
      labels:
        app: srs
    spec:
      volumes:
      - name: config-volume
        configMap:
          name: srs-config
      containers:
      - name: srs
        image: ossrs/srs:3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 1935
        - containerPort: 1985
        - containerPort: 8080
        volumeMounts:
        - name: config-volume
          mountPath: /usr/local/srs/conf
EOFYou can view the running pods:
Mac:trunk chengli.ycl$ pod=`kubectl get po|grep srs-deploy|awk '{print $1}'`
Mac:trunk chengli.ycl$ kubectl exec $pod -- cat conf/srs.conf && echo ""
listen              1935;
max_connections     1000;
daemon              off;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
    }
    hls {
        enabled         on;
    }
}When ConfigMap changes, you can use fsnotify to receive notifications of file changes, thereby triggering the reload of SRS.
TRANS_BY_GPT3
Metadata
Metadata
Assignees
Labels
FeatureIt's a new feature.It's a new feature.KubernetesFor K8s, Prometheus, APM and Grafana.For K8s, Prometheus, APM and Grafana.TransByAITranslated by AI/GPT.Translated by AI/GPT.