I am trying to deploy a WordPress site with MySQL database using kops. When I run these YAML files the PVC is in pending state and doesn't create the volume on ebs. I first thought it was because of the availability zone in the storage YAML file but I have tried all the possible combinations but no luck.
Storage class
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2 
  zone: us-east-2a
  iopsPerGB: "10"
reclaimPolicy: Delete
allowVolumeExpansion: false
Persistent volume claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wp-pv-claim
  labels:
    app: wordpress
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
Deployment:
apiVersion: apps/v1 
kind: Deployment
metadata:
  name: wordpress
  labels:
    app: wordpress
spec:
  selector:
    matchLabels:
      app: wordpress
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wordpress
        tier: frontend
    spec:
      containers:
      - image: wordpress:4.8-apache
        name: wordpress
        env:
        - name: WORDPRESS_DB_HOST
          value: wordpress-mysql
        - name: WORDPRESS_DB_PASSWORD
          value: 123a
        ports:
        - containerPort: 80
          name: wordpresss
        volumeMounts:
        - name: wordpress-persistent-storage
          mountPath: /var/www/html
      volumes:
      - name: wordpress-persistent-storage
        persistentVolumeClaim:
          claimName: wp-pv-claim
Service:
apiVersion: v1
kind: Service
metadata:
  name: wordpress
  labels:
    app: wordpress
spec:
  selector:
    app: wordpress
    tier: frontend
  type: NodePort
  ports:
    - nodePort: 30007 
      port: 80
      targetPort: 80
I am creating a cluster using this command:
kops create cluster \
--node-count=1 \
--node-size=t2.micro \
--master-size=t2.small \
--zones=us-east-2a \
--name=${KOPS_CLUSTER_NAME}
				
                        
As I suspected in my first comment, you don't have enough resocurces to run
mysqlandwordpress.If you will check Amazon instance types you will see that
t2.nanoandt2.smallhave quite low resources.Also as you mention in your last comment:
mysql the volumn bound but then wordpress pod go to pending state while mysql pod is healthy
It's because cluster do not have enough resources to start pod.
If you will use
kubectl describe pod <wordpress-pod-name>you would get output similar to:Cluster with that amount of resources won't be able to run
wordpressandmysql. Please keep in mind that also kubernetes default pods are running, to check which one, you can runkubectl get pods -A.Solution:
t2.largewith more resources