LoginSignup
4

More than 1 year has passed since last update.

posted at

updated at

Organization

Kubernetes 1.20: SIG-Apps の変更内容

はじめに

このページではKubernetes v1.20 における SIG-Apps に関連する変更内容をまとめています。

SIG-AppsはKubernetesのワークロードの扱いなどの変更を主に扱っているため、他のSIGと関係する変更が多くなっております。

ここに記載されていないものは別のまとめで記載されていると思いますので Kubernetes 1.20: 変更点まとめ(What's new!) も合わせて参照してみてください。

:pencil: がついた文章は、CHANGELOGの公式内容ではなく筆者の補足です。

:warning: Urgent Upgrade Notes (アップグレード前の注意点)

  • node.k8s.io API groups の v1beta1v1 に昇格します。 v1beta1 は非推奨となり、将来的には削除されます。今後使用する場合は v1 を使用してください。 (#95718, @SergeyKanzhelev) [SIG Apps, Auth, Node, Scheduling and Testing]

    • :pencil: Runtime Class について詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • dual-stack Services (alpha) が追加されます。 これは alpha API に対する破壊的な変更になります。この変更で、dual-stack Services の ipFamily という単一のフィールドが ipFamilyPolicy (SingleStack, PreferDualStack, RequireDualStack) 、 ipFamilies (アサインされた families のリスト)、clusterIPs (clusterIPを含む)の 3つに変更になります。ユーザは特に意識する必要はなくデフォルトで値が設定されます。 ユーザが Service を dual-stack でしようとしない限り、 single-stack で動作します。この動作は feature gate の IPv6DualStack で制御されます。(#91824, @khenidak) [SIG API Machinery, Apps, CLI, Network, Node, Scheduling and Testing]

    • :pencil: IPv4/IPv6 dual-stack について詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • 不正な ownerReference を検知した際の garbage collection controller の振る舞いを解決します。オーナーと子のオブジェクトの namespace が異なる場合、OwnerRefInvalidNamespace という Event が記録されます。kubectl-check-ownerreferences を使用すると事前に無効な ownerReferences 見つけることができます。

    • namespaced オブジェクトが ownerReference として参照している namespaced オブジェクトの uid が同じ namespace に存在しない場合、owner がいないものとして子のオブジェクトは削除されます。
    • cluster-scoped のオブジェクトが ownerReference として namespaced オブジェクトを参照していた場合、owner の解決ができないものとして、garbage collector から無視されます。(#92743, @liggitt) [SIG API Machinery, Apps and Testing]
    • :pencil: Garbage Collection の 1.20 での挙動の変更については公式サイトのこちらにも記載があります。

In v1.20+, if the garbage collector detects an invalid cross-namespace ownerReference, or a cluster-scoped dependent with an ownerReference referencing a namespaced kind, a warning Event with a reason of OwnerRefInvalidNamespace and an involvedObject of the invalid dependent is reported. You can check for that kind of Event by running kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace .

Changes by Kind

:wastebasket: Deprecation(非推奨)

  • PodPreset APIv1alpha1 と admission plugin は削除されれ、組み込まれた代替手段はありません。 Admission webhooks を使えば pod の作成時に変更を加えることができます。 (#94090, @deads2k) [SIG API Machinery, Apps, CLI, Cloud Provider, Scalability and Testing]
    • :pencil: PodPreset について詳しい内容を知りたい方は公式サイトのこちらをご参照ください

:earth_asia: API Changes(変更)

  • EndpointSlice API に serving と terminating の condition が追加されました。serving は endpoints の terminating の状態に関係なく、endpoints の readiness を追跡します。ready は Pods が terminating でない時に、true となるので、この状態は明確には ready と区別されます。terminating が true の時に、endpoint は terminating となります。 Pods の場合は deletion timestamp をもつ endpoint となります。(#92968, @andrewsykim) [SIG Apps and Network]

  • downward API に hugepages をサポートする機能が追加されました(#86102, @derekwaynecarr) [SIG API Machinery, Apps, CLI, Network, Node, Scheduling and Testing]

    • :pencil: hugepages について詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • Endpoints と Services に関する AppProtocol の機能が GA になりました。 k8s v1.21 から ServiceAppProtocol の feature gate が deprecated になります。 (#96327, @robscott) [SIG Apps and Network]

    • :pencil: こちらについて詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • services type LoadBalancer 利用時に自動で NodePorts を割り当てる機能を無効にできる新しいパラメータが追加されました。 default では既存と同じように services type LoadBalancer 利用時に自動で NodePorts を割り当てる挙動をします。(#92744, @uablrek) [SIG Apps and Network]

    • :pencil: ServiceLBNodePortControl の feature gate が k8s v1.20 で Alpha になりました。
    • :pencil: MetalLBなどでは、Nodeport を消費しない Services type LoadBalancer の実装があるので、不要な割り当てをよくしする機能を作ろうということのようです。
    • :pencil: 既存と同じ挙動になるよう default値が spec.allocateLoadBalancerNodePorts=true で設定されます。
    • :pencil: もう少し詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • Service オブジェクトの特定の field については service の type を変更した際に、そのモードで必要としない field が自動で削除されます。例えば type=LoadBalancer から type=ClusterIP に変更した際にユーザが削除することなく、 NodePort 削除されます。(#95196, @thockin) [SIG API Machinery, Apps, Network and Testing]

  • service.spec.topologyKeys を使用するには ServiceTopology feature が必要なことが文書化されました。(#96528, @andrewsykim) [SIG Apps]

    • :pencil: ServiceTopology について知りたい方は公式サイトのこちらをご参照ください
  • EndpointSlice は EndpointSliceNodeName feature gate で保護された新しい NodeName field を持ちます。

    • EndpointSlice topology field は今後のリリースで deprecated になります。
    • EndpointSlice "IP" address type は Kubernetes 1.17 で deprecated になった後に正式に削除されました。
    • discovery.k8s.io/v1alpha1 API は deprecated になり、 Kubernetes 1.21 で削除予定になります。 (#96440, @robscott) [SIG API Machinery, Apps and Network]
  • container のリソースの使用状況に HPA でスケールするためのメトリクスが追加されます。 (#90691, @arjunrn) [SIG API Machinery, Apps, Autoscaling and CLI]

    • :pencil: MixedProtocolLBService の feature gate が k8s v1.20 で Alpha になりました。
    • :pencil: この機能について詳しい内容を知りたい方は公式サイトのこちらをご参照ください。
    • :pencil: Pod じゃなくて Container 単位に出来るようになったので、logging 用の sidecar のとかのリソースの使用状況に依存せずに、メインの Container だけのリソースの使用状況で HPA が機能するようになれば利用ケースが増えるかなと思います。この機能については以下のような形で使用するようです。

      type: ContainerResource
      containerResource:
        name: cpu
        container: application
        target:
          type: Utilization
          averageUtilization: 60
      
  • Kube-apiserver は 期限が切れた kube-apiserver Lease objects を削除するようになりました。

    • この機能は、feature gate APIServerIdentity の配下になります。
    • kube-apiserver に identity-lease-garbage-collection-check-period-seconds という新しい flag が追加されました。(#95895, @roycaihw) [SIG API Machinery, Apps, Auth and Testing]
  • Kube-controller-manager: volume plugins は --volume-host-allow-local-loopback=false を設定することで、local と loopback addresses からの接続を制限することができます。また、--volume-host-cidr-denylist を設定することで特定の CIDR からの接続に制限することができます。 (例 --volume-host-cidr-denylist=127.0.0.1/28,feed::/16) (#91785, @mattcary) [SIG API Machinery, Apps, Auth, CLI, Network, Node, Storage and Testing]

  • Migrate scheduler、 controller-manager、 cloud-controller-manager は LeaseLock を使用します。(#94603, @wojtek-t) [SIG API Machinery, Apps, Cloud Provider and Scheduling]

  • DNS-1123 error messages が変更されたことにより、 RFC 1123 に準拠してないことがわかります。 (#94182, @mattfenwick) [SIG API Machinery, Apps, Auth, Network and Node]

  • configurable fsgroup change policy for pods が beta になります。 (#96376, @gnufied) [SIG Apps and Storage]

    • :pencil: この機能について詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • Reminder: "failure-domain.beta.kubernetes.io/zone"、 "failure-domain.beta.kubernetes.io/region" のラベルが deprecated になり、 "topology.kubernetes.io/zone" 、 "topology.kubernetes.io/region" のラベルが推奨になります。 "failure-domain.beta..." のラベルを使用している全てのユーザは "topology..." のラベルに切り替える必要があるかも。 (#96033, @thockin) [SIG API Machinery, Apps, CLI, Cloud Provider, Network, Node, Scheduling, Storage and Testing]

  • 新しい MixedProtocolLBService feature gate を有効化している場合、同じ LoadBalancer Service で異なるプロトコルを使用できます。feature gate は default では disabled になっています。ユーザが使用する場合には、API Server の feature gate(MixedProtocolLBService) を enable にする必要があります。(#94028, @janosi) [SIG API Machinery and Apps]

    • :pencil: MixedProtocolLBService の feature gate が k8s v1.20 で Alpha になりました。
    • :pencil: この機能について詳しい内容を知りたい方は公式サイトのこちらをご参照ください
    • :pencil: 対象の KEP の提案を見ると以下のような形での使用を考えているようです。(Service type LoadBalancer は環境毎に実装が異なるので、使用を検討する場合は、各環境での対応状況を確認する必要があります。)

      apiVersion: v1
      kind: Service
      metadata:
        name: mixed-protocol
      spec:
        type: LoadBalancer
        ports:
          - name: dns-udp
            port: 53
            protocol: UDP
          - name: dns-tcp
            port: 53
            protocol: TCP
        selector:
          app: my-dns-server
      
  • この PR で CSIDriverSpec に新しい2つのフィールドをもつ CSIServiceAccountToken feature gate が追加されました。 (#93130, @zshihang) [SIG API Machinery, Apps, Auth, CLI, Network, Node, Storage and Testing]

    • :pencil: CSIServiceAccountToken の feature gate が k8s v1.20 で Alpha になりました。
    • :pencil: 追加されるフィールドのイメージは以下になります。詳細について詳しく知りたい方はこちらご参照ください。

      apiVersion: storage.k8s.io/v1
      kind: CSIDriver
      metadata:
        name: mycsidriver.example.com
      spec:
      +  tokenRequests:
          - audience: "gcp"
          - audience: ""
            expirationSeconds: 3600
      +  requiresRepublish: true
      
  • feature gate を有効化することで cronjob controller v2 を試せるようになります。 将来のリリースで、 この controller が
    default になる予定です。 (#93370, @alaypatel07) [SIG API Machinery, Apps, Auth and Testing]

    • :pencil: CronJobControllerV2 の feature gate が k8s v1.20 で Alpha になりました。
    • :pencil: 公式サイトのこちらに少しだけ記載がありますので興味ある方はご参照ください
    • :pencil: 対象の KEP を確認すると、k8s v1.21 から Beta になった。 CronJob が現在の batch/v1beta1 から batch/v1 になっていくようです。k8s v1.22 で GA になっていく予定なので、現在使用してる方は、k8s v1.21 の導入あたりで移行の検討をされた方が良さそうですね。
  • VolumeSnapshotDataSource が 1.20 のリリースで GA in 1.20 になりました。 (#95282, @xing-yang) [SIG Apps]

    • :pencil: VolumeSnapshotDataSource の feature gate が k8s v1.20 で GA になりました。

:sparkle: FEATURE(機能追加)

  • components の helper code を共有する新しい k8s.io/component-helpers repository が追加されました。 (#92507, @ingvagabund) [SIG Apps, Node, Release and Scheduling]

  • Ephemeral containers が initContainers と containers と同じ API を default で使用するようになります。(#94896, @wawa0210) [SIG Apps and CLI]

  • API objects (Pod, Service, NetworkPolicy) に対する SCTP のサポートが GA になりました。これはノードの kernel level で有効化されているかどうかに影響しないので注意してください。また、cloud platform や network plugin によっては SCTP をサポートしていないため注意が必要です。(#95566, @danwinship) [SIG Apps and Network]

    • :pencil: SCTPSupport の feature gate が k8s v1.20 で GA になりました。
    • :pencil: もう少し詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • RootCAConfigMap feature gate は beta となり default で有効化されます。kube-controller-manager が "kube-root-ca.crt" ConfigMap を全ての namespace に公開します。この ConfigMap には kube-apiserver に接続するための CA がバンドルされています。 (#96197, @zshihang) [SIG API Machinery, Apps, Auth and Testing]

    • :pencil: RootCAConfigMap の feature gate が k8s v1.20 で Beta になりました。
    • :pencil: もう少し詳しい内容を知りたい方は公式サイトのこちらをご参照ください
  • volume plugin name と volume mode で persistent volumes をカウントする新しいメトリクス pv_collector_total_pv_count が追加されました。(#95719, @tsmetana) [SIG Apps, Instrumentation, Storage and Testing]

:tools: ENHANCEMENT(機能改善)

  • なし

:bug: BUGFIX(バグ修正)

  • PVC StorageClass が out-of-tree provisioner によって既に更新されている時に、 volume expand controller が PVC に volume.kubernetes.io/storage-resizer アノテーションをつけるのを妨げる問題が修正されました。 (#94489, @ialidzhikov) [SIG API Machinery, Apps and Storage]

  • CSIDriver object が volume に attachment してる最中に、 deploy 出来るようになりました。 (#93710, @Jiawei0227) [SIG Apps, Node, Storage and Testing]

  • ceph と glusterfs intree-volumeChange を除いて、mount 方法を systemd から normal mount に変更します。(#94916, @smileusd) [SIG Apps, Cloud Provider, Network, Node, Storage and Testing]

  • 不適切な storage と endpoints の比較により endpoints controller から発生する過剰な API traffic が発生するバグが修正されました。 (#94112, @damemi) [SIG Apps, Network and Testing]

  • SelectPolicy MinPolicySelect を scaleUp behavior もしくは scaleDown behavior に設定した場合に、 Horizontal Pod Autoscaler が自動で pod数を正しくスケールしないバグが修正されました。 (#95647, @JoshuaAndrew) [SIG Apps and Autoscaling]

  • もし、十分な healthy な pod があれば、 PDBs によってカバーされている unhealthy な pod の evict が成功するようになります。 (#94381, @michaelgugino) [SIG Apps]

    • :pencil: PDB が設定された状態で、 Pod を evict するときに対象の Pod が異常な状態であるケースが想定されていなかったため、その場合を考慮するように修正されました。
  • Volume binding:バインドされた PV が見つからない場合に、 error ではなく UnschedulableAndUnresolvable の status を返すようになります。 (#95541, @cofyc) [SIG Apps, Scheduling and Storage]

  • volume.beta.kubernetes.io/storage-provisioner の annotation が既に設定された PVC を作ろうとしたときに、タイミングとシステム負荷の状況によって PV controller が新しくプロビジョニングした PV をバインドする代わりに、誤って削除した可能性があります。 (#95909, @pohly) [SIG Apps and Storage]

:microscope: Other (その他の修正)

  • KEP や ドキュメントの使い方等に関する文章が追加されました。(#96443, @alaypatel07 )[SIG Apps]

    • :pencil: PR の中を見ると、 ControllerV2 のリファクタリングに見えるので、他のPRとのマッピングのミスのように見えます。
  • V1helpers.MatchNodeSelectorTerms は Node と 用語のリストだけを受け入れるようにします。 (#95871, @damemi) [SIG Apps, Scheduling and Storage]

  • MatchNodeSelectorTerms function が k8s.io/component-helpers に移動しました。(#95531, @damemi) [SIG Apps, Scheduling and Storage]

所感

今回、SIG-Apps としては CronJob の GA に向けて、CronJobControllerV2 が登場したことが大きな変化だったと思います。CronJob は k8s v1.8 で beta になって以降、実はずっと GA になっていませんでした。

Cronjob のこれまで

Kubernetes のバージョン 出来事
v1.3 ScheduledJobs と登場 :sunrise:
v1.8 CronJob に名前が変更され、 Beta に昇格 :sunglasses:
v1.19 v1.22 までに進展がないと非推奨となり、v1.25 で消える運命となる :innocent:

Cronjob の既存の課題と GA に向けての動き

既存の CronJobController には機能面での bug がいくつか放置されたままになっていたことと、他の GA になっている Controller のように Informers と WorkQueue が使用されておらず、性能面でも懸念があったため、この度新規で V2CronJobController 作成して GA を目指す形となりました。

:pencil: GA にするにあたりこちらのガイドラインに準拠してないことが課題に挙げられてますが、参考になるドキュメントなので、Controller を作りたいと思ってる方は一読してみてもいいかもしれません。
:pencil: コントリビュートしたい人への向けてのドキュメントがこちらに色々あるので興味ある人はみてみると面白いと思います。

V2 の今後の予定

Kubernetes のバージョン Feature Gates 予定
v1.20 Alpha :beginner: CronJobControllerV2 を有効化することで使用可能
v1.21 Beta :sunglasses: CronJobControllerV2 がデフォルトで有効化。disable にすることで既存の Controller も使用可能
batch/v1が追加されます
v1.22 GA :tada: 既存の Controller 削除されて使用できなくなります。

CronJobControllerV2 を有効化すると、裏で実行する Controller 変わるような形になります。予定通り、v1.21 で Beta となる場合は、デフォルトで動作する Controller が変わることになるため、Cronjob を使用している場合は動作確認した上で、k8s をアップグレードされた方が良いと思います。

何はともあれ、CronJobControllerV2 の今後を楽しみにしてます。

気になった点

SIG-Apps ではないのですが、以下の変更が個人的に気になりました。

  • Kubeadm: http://git.k8s.io/enhancements/keps/sig-cluster-lifecycle/kubeadm/2067-rename-master-label-taint/README.md (#95382, @neolit123) [SIG Cluster Lifecycle]
    • The label applied to control-plane nodes "node-role.kubernetes.io/master" is now deprecated and will be removed in a future release after a GA deprecation period.
    • Introduce a new label "node-role.kubernetes.io/control-plane" that will be applied in parallel to "node-role.kubernetes.io/master" until the removal of the "node-role.kubernetes.io/master" label.
    • Make "kubeadm upgrade apply" add the "node-role.kubernetes.io/control-plane" label on existing nodes that only have the "node-role.kubernetes.io/master" label during upgrade.
    • Please adapt your tooling built on top of kubeadm to use the "node-role.kubernetes.io/control-plane" label.
    • The taint applied to control-plane nodes "node-role.kubernetes.io/master:NoSchedule" is now deprecated and will be removed in a future release after a GA deprecation period.
    • Apply toleration for a new, future taint "node-role.kubernetes.io/control-plane:NoSchedule" to the kubeadm CoreDNS / kube-dns managed manifests. Note that this taint is not yet applied to kubeadm control-plane nodes.
    • Please adapt your workloads to tolerate the same future taint preemptively.

これは、Kubeadm での control-plane ノードのラベルが以下のように変わっていくという変更になります。

- node-role.kubernetes.io/master
+ node-role.kubernetes.io/control-plane

Kubeadm でクラスタを構築して helm にあるような manifest を参考にして、 DaemonSet を以下のように記述して使用しているケースはそれなりにあるかなと思います。

apiVersion: apps/v1
kind: DaemonSet

      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists

仮に Node Exporter のような監視系のツールを DaemonSet で運用していてラベルの変更に気づいていないと、特にエラーにもならずにスケジュールされないだけになるので、アップグレード時に気づかずに監視が不十分なまま運用されたりすることが起こりそうだなと思って気にしてます。

Kubernetes を運用しているとラベル名の変更の確認漏れが重大な事故に繋がる可能性もあるので、この観点にも注意しながら変更点を確認してみると良いかなと思います。

:pencil:名称を master から control plane に変更する件については wg-namingこちらに詳しい話が書かれています。他にも blacklist/whitelistallowlist/denylist に置き換える話がワーキンググループで話し合われています。今後、みなさんが k8s の構成図を作成するときなどに、 Master Node とは書かずに Control Plane Node と書くといいかもしれません。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
4