【发布时间】:2023-02-03 13:09:29
【问题描述】:
您好,我在 Kubernetes 工作。下面是我用于部署的 k8。
apiVersion: apps/v1
kind: Deployment
metadata: #Dictionary
name: webapp
spec: # Dictionary
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
# maxUnavailable will set up how many pods we can add at a time
maxUnavailable: 50%
# maxSurge define how many pods can be unavailable during the rolling update
maxSurge: 1
selector:
matchLabels:
app: webapp
instance: app
template:
metadata: # Dictionary
name: webapplication
labels: # Dictionary
app: webapp # Key value paids
instance: app
annotations:
vault.security.banzaicloud.io/vault-role: al-dev
spec:
serviceAccountName: default
terminationGracePeriodSeconds: 30
containers: # List
- name: al-webapp-container
image: ghcr.io/my-org/al.web:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
resources:
requests:
memory: "1Gi"
cpu: "900m"
limits:
memory: "1Gi"
cpu: "1000m"
imagePullSecrets:
- name: githubpackagesecret
每当我将它部署到 kubernetes 中时,它都不会从 github 包中选择最新的图像。我应该怎么做才能拉取最新图像并使用最新图像更新当前运行的 pod?有人可以帮我解决这个问题。任何帮助,将不胜感激。谢谢
【问题讨论】:
-
您的 Pod 正在重新启动和更新?你什么时候部署?标签已设置并且部署没有变化 k8s 不会更新部署并且它将保持不变。
-
当我部署 k8 时,我看到旧图像正在部署
-
这事有进一步更新吗 ?如果发现以下答案有帮助,请随时更新问题的状态
标签: kubernetes docker-container kubernetes-deployment