Kubernetes GKE in GCP replicas number doesn't match

11/9/2018

I have the following yaml file with replica set with 3 but when I deploy it on GKE in the yaml and in the console the number of replicas is only one. When I deploy the pods are created but then are terminated. I forgot something?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: xxx-nginx
  namespace: xxx
  labels:
    app: xxx-nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: xxx-nginx
  template:
    metadata:
      labels:
        app: xxx-nginx
    spec:
      volumes:
      - name: xxx-nginx
        configMap:
          name: xxx-nginx-configmap
      containers:
      - name: xxx-nginx
        image: nginx:1.15.3
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /etc/nginx/conf.d
          name: xxx-nginx
        readinessProbe:
          httpGet:
            path: /nginx-health
            port: 80
          initialDelaySeconds: 15
          timeoutSeconds: 1
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /nginx-health
            port: 80
          initialDelaySeconds: 15
          timeoutSeconds: 1
          periodSeconds: 10
        resources:
          requests:
            memory: 128Mi
            cpu: 100m
          limits:
            memory: 128Mi
            cpu: 100m

This is what I see on GCP console :

enter image description here

[EDIT]

I also add the HPA :

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: xxxx-hpa
  namespace: xxx
  labels:
    app: xxx-hpa
spec:
  scaleTargetRef:
    kind: Deployment
    name: xxx-phpfpm
    apiVersion: apps/v1
  minReplicas: 1
  maxReplicas: 10
  targetCPUUtilizationPercentage: 60

Thank you, regards

-- Alessandro Candon
google-kubernetes-engine
kubernetes
replicaset

1 Answer

11/10/2018

Thank you @apisim with his comment I found the problem... The HPA commands, so if minReplicas is 1 there will be only one pod in production...

Thanks Regards

-- Alessandro Candon
Source: StackOverflow