2023-04-16

I can't get a video to play on my nginx server through kubernetes

again. I tried all of your suggestions and couldn't figure it out. For the newcomers to this post, I am trying to get a local video on a nginx server hosted with Kubernetes. I have tried more, and now my files look as so

configMap:


    apiVersion: v1
kind: ConfigMap
metadata:

  name: index-html-configmap
  namespace: default

data:
  index.html:

    <video width="1920" height="1080" autoplay loop muted>
    <source src="/usr/share/nginx/html/video/movie.mp4" type="video/mp4" />

    Your browser does not support the video tag.
    </video>`

Deployment file:

apiVersion: apps/v1

kind: Deployment

metadata:

  name: nginx-deployment
  namespace: default

spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:

      - name: nginx

        image: nginx:latest

        ports:

        - containerPort: 80
        volumeMounts:
            - name: nginx-index-file
              mountPath: /usr/share/nginx/html
            - name: movie
              mountPath: /usr/share/nginx/html/video/movie.mp4
      volumes:
      - name: nginx-index-file

        configMap:
          name: index-html-configmap
      - name: movie
        configMap:
          name: index-html-configmap

Please help



No comments:

Post a Comment