munnerz / kube-plex

Scalable Plex Media Server on Kubernetes -- dispatch transcode jobs as pods on your cluster!
Apache License 2.0
1.22k stars 193 forks source link

Error: create: failed to create: namespaces "plex" not found #102

Open jtv199 opened 4 years ago

jtv199 commented 4 years ago

Hi, I'm trying to run plex-Kube on my ubuntu. Though I am encountering this error. Though Plex media server runs fine. I am not sure what the problem is.

helm install plex ./charts/kube-plex     --namespace plex     --set claimToken=[claim-XXXXXXXXX]     --set persistence.data.claimName=existing-pms-data-pvc     --set ingress.enabled=true
Error: create: failed to create: namespaces "plex" not found
gwyden commented 4 years ago

did you create the namespace? the namespace is not defined in the helm chart. Where did you create your pvc? that is namespace dependent .

List Namespaces: kubectl get ns -A

List pvc with namespace kubectl get pvc -A

If you just need to create the namespace a simple kubectl create ns plex will get the job done

jtv199 commented 4 years ago

Yes I think that was the problem, Thanks.

I have received this in response

NAME: plex
LAST DEPLOYED: Wed May  6 17:36:46 2020
NAMESPACE: plex
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  http://chart-example.local

But I cannot see it in kubectl get pods as it only shows

NAME                                READY   STATUS    RESTARTS   AGE
hello-node-7bf657c596-v48ld         1/1     Running   1          149m
mysql-1588742074-6b4798b5d9-lgv4b   0/1     Pending   0          9m35s

Nor am I able to access the link http://chart-example.local. Sorry, I am still a bit new to Kubernetes.

hectorleiva commented 4 years ago

@jtv199 I think you need to also specify in kubectl get pods the namespace as well?

kubectl get pods -n plex should return all the pods within the plex namespace.

What do you get when you run kubectl get all -n plex?

jtv199 commented 4 years ago

Yes, After I ran kubectl get all -n plex it seems to be here. I am not sure why its not ready though.

NAME                                  READY   STATUS    RESTARTS   AGE
pod/plex-kube-plex-678f84659b-rhljv   0/1     Pending   0          15d

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                    AGE
service/plex-kube-plex   ClusterIP   10.103.180.191   <none>        32400/TCP,80/TCP,443/TCP   15d

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/plex-kube-plex   0/1     1            0           15d

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/plex-kube-plex-678f84659b   1         1         0       15d
jtv199 commented 4 years ago

here is what I get by running kubectl describe pod plex-kube-plex-678f84659b-rhljv -n plex.

Name:           plex-kube-plex-678f84659b-rhljv
Namespace:      plex
Priority:       0
Node:           <none>
Labels:         app=kube-plex
                pod-template-hash=678f84659b
                release=plex
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  ReplicaSet/plex-kube-plex-678f84659b
Init Containers:
  kube-plex-install:
    Image:      quay.io/munnerz/kube-plex:latest
    Port:       <none>
    Host Port:  <none>
    Command:
      cp
      /kube-plex
      /shared/kube-plex
    Environment:  <none>
    Mounts:
      /shared from shared (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from plex-kube-plex-token-m6qv6 (ro)
Containers:
  plex:
    Image:       plexinc/pms-docker:1.16.0.1226-7eb2c8f6f
    Ports:       32400/TCP, 32400/TCP, 32443/TCP
    Host Ports:  0/TCP, 0/TCP, 0/TCP
    Liveness:    http-get http://:32400/identity delay=10s timeout=10s period=10s #success=1 #failure=3
    Readiness:   http-get http://:32400/identity delay=15s timeout=5s period=10s #success=1 #failure=3
    Environment:
      TZ:                    Europe/London
      PLEX_CLAIM:            [claim-PooPBMsbyEjyigT-_hec]
      PMS_INTERNAL_ADDRESS:  http://plex-kube-plex:32400
      PMS_IMAGE:             plexinc/pms-docker:1.16.0.1226-7eb2c8f6f
      KUBE_NAMESPACE:        plex (v1:metadata.namespace)
      TRANSCODE_PVC:         plex-kube-plex-transcode
      DATA_PVC:              existing-pms-data-pvc
      CONFIG_PVC:            plex-kube-plex-config
    Mounts:
      /config from config (rw)
      /data from data (rw)
      /shared from shared (rw)
      /transcode from transcode (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from plex-kube-plex-token-m6qv6 (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  existing-pms-data-pvc
    ReadOnly:   false
  config:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  plex-kube-plex-config
    ReadOnly:   false
  transcode:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  shared:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  plex-kube-plex-token-m6qv6:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  plex-kube-plex-token-m6qv6
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  beta.kubernetes.io/arch=amd64
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  <unknown>            default-scheduler  persistentvolumeclaim "existing-pms-data-pvc" not found
  Warning  FailedScheduling  12d (x609 over 15d)  default-scheduler  persistentvolumeclaim "existing-pms-data-pvc" not found
hectorleiva commented 4 years ago

persistentvolumeclaim "existing-pms-data-pvc" not found is a pretty interesting find.

try:

kubectl get pvc -n media

It needs to return something like this:

NAME        STATUS   VOLUME      CAPACITY   ACCESS MODES   STORAGECLASS   AGE
media-ssd   Bound    media-ssd   250Gi      RWX            manual         33d

and definitely relate to your actual Persistent Volume like this:

kubectl get pv -n media
NAME                 CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                        STORAGECLASS   REASON   AGE
media-ssd            250Gi      RWX            Retain           Bound    media/media-ssd              manual                  33d
jtv199 commented 4 years ago

ok, when I entered kubectl get pv -n media I recieved No resources found in media namespace.

then i checked kubectl get pvc -A

NAMESPACE   NAME                    STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
default     mysql-1588742074        Bound    pvc-8b255e8b-6328-4838-9883-cb313305c778   8Gi        RWO            standard       25d
plex        plex-kube-plex-config   Bound    pvc-85d9a3dd-5ae4-4228-a055-fccac1854aa5   20Gi       RWX            standard       24d

I didn't create the media namespace before using the helm chart, should I have done that? Also should Have replaced --set persistence.data.claimName=existing-pms-data-pvc with the location of my media files or is it fine the way it is?

hectorleiva commented 4 years ago

You didn't have to create the media namespace, I happened to have done that; but you used plex, so that's fine.

It sounds like the issue is that you created a Persistent Volume Claim called plex-kube-plex-config, but without an actual Persistent Volume - it won't do anything.

As far as I understand, PV (Persistent Volume) is the actual volume itself. It is an abstraction term because your PV could be a harddrive, an Amazon S3, or could be whatever - but Kubernetes needs you to set that up first.

The PVC (Persistent Volume Claim) is also an abstraction where you tell your apps which PV can fulfill their space requirements.

Since you set-up the PVC (the promise) but with no PV to fulfill that promise, then it won't work.

Set-up a PV in your plex namespace; it can be of more space than the PVC is promising for.

As per your question about what --set persistence.data.claimName should be set to - you need to set that to the name of your PVC, which from your command:

kubectl get pvc -A

You only have 2 options:

mysql-1588742074
plex-kube-plex-config

so it should be: --set persistence.data.claimName=plex-kube-plex-config