geerlingguy / tower-operator

DEPRECATED: This project was moved and renamed to: https://github.com/ansible/awx-operator
82 stars 34 forks source link

awx-postgres-0 pod pending (PersistentVolumeClaim) #28

Closed nicolaibaralmueller closed 4 years ago

nicolaibaralmueller commented 4 years ago

Hi Jeff,

I am completely new to Kubernetes and managed to configure an Ubuntu Server with microk8s.

awx-postgres-0 is in a constant pending state the output is shown here:

Name:           awx-postgres-0
Namespace:      awx
Priority:       0
Node:           <none>
Labels:         app=tower-postgres
                controller-revision-hash=awx-postgres-5599b677
                statefulset.kubernetes.io/pod-name=awx-postgres-0
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  StatefulSet/awx-postgres
Containers:
  postgres:
    Image:      postgres:10
    Port:       3306/TCP
    Host Port:  0/TCP
    Environment:
      POSTGRES_DB:        awx
      POSTGRES_USER:      awx
      POSTGRES_PASSWORD:  <set to the key 'password' in secret 'awx-postgres-pass'>  Optional: false
    Mounts:
      /var/lib/postgresql/data from postgres (rw,path="data")
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fxk6j (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  postgres:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  postgres-awx-postgres-0
    ReadOnly:   false
  default-token-fxk6j:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-fxk6j
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  20s (x15 over 18m)  default-scheduler  error while running "VolumeBinding" filter plugin for pod "awx-postgres-0": pod has unbound immediate PersistentVolumeClaims

The guide does not really explain how to setup postgres?

Thanks

nicolaibaralmueller commented 4 years ago

So for other new kubernetes users:

I had to enable storage in cluster first.

  1. microk8s.kubectl delete namespace
  2. microk8s.enable storage
  3. kubectl apply -f .yaml
geerlingguy commented 4 years ago

Yep! Glad you could figure it out; basically pod has unbound immediate PersistentVolumeClaims means that Kubernetes couldn't create a persistent volume, and that's often due to either no storage being configured in the cluster, or there being inadequate storage available (e.g. if you request 1 TB of space but the underlying storage system only has 500 GB left...).