GCP 副本数中的 Kubernetes GKE 不匹配
Kubernetes GKE in GCP replicas number doesn't match
我有以下 yaml 文件,副本集为 3,但是当我在 yaml 和控制台中将它部署到 GKE 上时,副本数只有一个。
当我部署时, pods 被创建但随后被终止。我忘记了什么?
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
这是我在 GCP 控制台上看到的:
[编辑]
我还添加了 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
谢谢,问候
谢谢@apisim 的评论我发现了问题...
HPA 命令,因此如果 minReplicas 为 1,则生产中将只有一个 pod...
谢谢问候
我有以下 yaml 文件,副本集为 3,但是当我在 yaml 和控制台中将它部署到 GKE 上时,副本数只有一个。 当我部署时, pods 被创建但随后被终止。我忘记了什么?
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
这是我在 GCP 控制台上看到的:
[编辑]
我还添加了 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
谢谢,问候
谢谢@apisim 的评论我发现了问题... HPA 命令,因此如果 minReplicas 为 1,则生产中将只有一个 pod...
谢谢问候