zoukankan      html  css  js  c++  java
  • 【Kubernetes】镜像拉取策略-Always

    环境

    1. kubernetes 1.20.4
    2. Spring Boot 2.5.0-M2

    目标

    将镜像拉取策略设置成 Always 的情况下,每次启动 Pod 都会拉取镜像。

    镜像拉取策略

    Pod.yaml

    apiVersion: v1
    kind: Pod
    metadata:
      name: busybox
    spec:
      containers:
        - name: busybox
          image: busybox:stable
          imagePullPolicy: Always
          resources:
            limits:
              memory: "128Mi"
              cpu: "500m"
          command: ["sleep", "3600"]
    

    查看

    Events:
      Type    Reason     Age    From               Message
      ----    ------     ----   ----               -------
      Normal  Scheduled  4m38s  default-scheduler  Successfully assigned default/busybox to node2
      Normal  Pulling    4m37s  kubelet            Pulling image "busybox:stable"
      Normal  Pulled     4m20s  kubelet            Successfully pulled image "busybox:stable" in 17.00572703s
      Normal  Created    4m20s  kubelet            Created container busybox
      Normal  Started    4m20s  kubelet            Started container busybox
    

    可以看到事件中,出现拉取镜像的事件。

    总结

    通过将镜像的拉取策略设置成 Always,来验证 k8s 对镜像的拉取策略。

    附录

  • 相关阅读:
    bzoj1081 [SCOI2005]超级格雷码
    bzoj3790 神奇项链
    bzoj2822 [AHOI2012]树屋阶梯
    bzoj1485 [HNOI2009]有趣的数列
    bzoj1486 [HNOI2009]最小圈
    bzoj2721 [Violet 5]樱花
    POJ 1238 Substrings
    ZOJ Team Formation
    POJ 1459 Power Network
    POJ 1458 Common Subsequence
  • 原文地址:https://www.cnblogs.com/jiangbo44/p/14571518.html
Copyright © 2011-2022 走看看