[正式提出为github issue,但我被要求在此发布]
我正在使用GKE(Kubernetes 1.2),并且大部分时间通过部署配置更改执行滚动更新时一切运行顺利。
偶尔事情不会。
如果没有,则部署正确升级,但没有创建相应的RS,因此旧的pod(部署映像不匹配)仍然存在。
我正在使用circle ci执行kubectl apply -f
,新配置中唯一更改为image
,以使其指向新标记。
$ kubectl get deployments ployst-ui-live-deployment -o=yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "95"
kubectl.kubernetes.io/last-applied-configuration: '{"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"ployst-ui-live-deployment","creationTimestamp":null},"spec":{"replicas":1,"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"ployst-ui","mode":"live"}},"spec":{"containers":[{"name":"ployst-ui","image":"eu.gcr.io/ployst-proto/ployst-ui:1.1445","ports":[{"containerPort":80}],"resources":{},"imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","dnsPolicy":"ClusterFirst"}},"strategy":{"type":"RollingUpdate"}},"status":{}}'
creationTimestamp: 2016-04-02T09:34:35Z
generation: 202
labels:
app: ployst-ui
mode: live
name: ployst-ui-live-deployment
namespace: default
resourceVersion: "7467578"
selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/ployst-ui-live-deployment
uid: 1c9fc5a2-f8b6-11e5-ae8f-42010af0000a
spec:
replicas: 1
selector:
matchLabels:
app: ployst-ui
mode: live
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: ployst-ui
mode: live
spec:
containers:
- image: eu.gcr.io/ployst-proto/ployst-ui:1.1445
imagePullPolicy: IfNotPresent
name: ployst-ui
ports:
- containerPort: 80
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
observedGeneration: 200
replicas: 1
updatedReplicas: 1
此广告连播应该已升级为
$ kubectl get pods ployst-ui-live-deployment-1482854615-w6hsg -o=yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
kubernetes.io/created-by: |
{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"ployst-ui-live-deployment-1482854615","uid":"ba2714da-5343-11e6-8d11-42010af0000a","apiVersion":"extensions","resourceVersion":"7392451"}}
kubernetes.io/limit-ranger: 'LimitRanger plugin set: cpu request for container
ployst-ui; cpu limit for container ployst-ui'
creationTimestamp: 2016-07-26T15:15:03Z
generateName: ployst-ui-live-deployment-1482854615-
labels:
app: ployst-ui
mode: live
pod-template-hash: "1482854615"
...
spec:
containers:
- image: eu.gcr.io/ployst-proto/ployst-ui:1.1422
imagePullPolicy: IfNotPresent
name: ployst-ui
...
部署似乎很好,只是它似乎认为它有一些匹配的pod。
是否检测不到图像更改标签?如果没有,为什么有时会这样做?
我正在尝试查找调度程序日志 - 也许在GKE上我无法使用它们?
更新
以下是kubectl describe deployment ployst-ui-live-deployment
的今天输出(根据要求提供)
Name: ployst-ui-live-deployment
Namespace: default
CreationTimestamp: Sat, 02 Apr 2016 09:34:35 +0000
Labels: app=ployst-ui,mode=live
Selector: app=ployst-ui,mode=live
Replicas: 1 updated | 1 total | 1 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 1 max unavailable, 1 max surge
OldReplicaSets: ployst-ui-live-deployment-935839453 (1/1 replicas created)
NewReplicaSet: <none>
No events.
这里设置的旧副本指向一个更新的副本,因为自此问题出现以来已经发生了许多部署。