Slide 1

Slide 1 text

Kubernetes v1.19 Updates Kubernetes Meetup Tokyo #34 / September 30, 2020 Shunya Murata @shmurata_

Slide 2

Slide 2 text

▶ アジェンダ 1. Ingress graduates to General Availability 2. seccomp graduates to General Availability 3. KubeSchedulerConfiguration graduates to Beta 4. Immutable Secrets and ConfigMaps (beta) 5. まとめ 2

Slide 3

Slide 3 text

Shunya Murata / @shmurata_ ▶ ゼットラボ株式会社 ソフトウェアエンジニア ▶ 2010年にヤフー株式会社に新卒⼊社、2015年ゼットラボ株式会社に出向 ▶ Kubernetes Meetup Tokyo の過去の発表 + ThirdPartyResource を使った Kubernetes as a Service の実装 (#3) + KubeCon EU 2019 Recap (#20) + プロダクションレディを⽬指したアップグレード戦略 (#29) 3

Slide 4

Slide 4 text

Ingress graduates to General Availability

Slide 5

Slide 5 text

▶ Ingress graduates to General Availability ▶ Ingress v1 + v1.1(2015/9/26 にRelease) で alpha ▶ Motivation + extensions API が Deprecated + 現在のAPI IF は完璧ではないが時間がない ▶ Goals + Permanent API Group(networking.k8s.io) への移⾏ + 現⾏機能の完全な互換を持った v1 5 KEP: https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/1453-ingress-api より抜粋

Slide 6

Slide 6 text

▶ Ingress v1: Spec Changes 6 apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: foo-bar spec: rules: - host: foo.bar.com http: paths: - path: /v1 backend: serviceName: service1 servicePort: 80 apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: foo-bar spec: rules: - host: foo.bar.com http: paths: - path: /v1 pathType: ImplementationSpecific backend: service: name: service1 port: number: 80

Slide 7

Slide 7 text

7 ▶ Ingress v1: backends can now be resource or service backends apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: foo-bar spec: rules: - host: foo.bar.com http: paths: - backend: resource: apiGroup: k8s.example.com kind: StorageBucket name: icon-assets ▶ Backend に Resource への参照が 追加 ▶ オブジェクトストレージなどへの 直接ルーティングすることが想定 されている + Ingrees Controller 次第?

Slide 8

Slide 8 text

▶ Ingress の今後 8 https://speakerdeck.com/thockin/kubecon-eu-2020-sig-network-intro-and-deep-dive?slide=72 ΑΓൈਮ

Slide 9

Slide 9 text

seccomp graduates to General Availability

Slide 10

Slide 10 text

▶ seccomp graduates to General Availability ▶ Seccomp GA + seccomp ⾃体はシステムコールを制限する Linux の機能 + Pod (Container) のシステムコールを制限することができる + v1.3(2016/07/02 にRelease) で導⼊されていたらしい ▶ Motivation + Annotation の状態のまま放置するとユーザに良くないためGAとして宣⾔し たい + AppArmorも似た状態(1.20に含める予定で進められている) ▶ Goals + GA に昇格すること + annotationを廃⽌し、spec で記述できるようにすること 10 KEP: https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/20190717-seccomp-ga.md より抜粋

Slide 11

Slide 11 text

11 ▶ seccomp GA: seccompProfile field apiVersion: v1 kind: Pod metadata: name: seccomp annotations: seccomp.security.alpha.kubernetes.io/pod: 'runtime/default' spec: containers: - image: nginx name: nginx apiVersion: v1 kind: Pod metadata: name: seccomp spec: securityContext: seccompProfile: type: RuntimeDefault containers: - image: nginx name: nginx Official document: https://kubernetes.io/docs/tutorials/clusters/seccomp/

Slide 12

Slide 12 text

12 ▶ seccomp の今後 ▶ v1.23 をターゲットに annotation を削除を進めている + https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/ 20190717-seccomp-ga.md#upgrade--downgrade ▶ PodSecurityPolicyもseccomp⽤のフィールドを追加する予定 + 1.19では含まれてない + https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/ 20190717-seccomp-ga.md#alternatives

Slide 13

Slide 13 text

KubeSchedulerConfiguration graduates to Beta

Slide 14

Slide 14 text

▶ KubeSchedulerConfiguration graduates to Beta ▶ 各コンポーネントの設定を ComponentConfig APIに移⾏する話のkube- scheduler の部分がBeta になりました + かなり前から提案されているがあまり進捗は良くない ▶ Motivation: https://github.com/kubernetes/enhancements/issues/115 より抜粋 + インストール操作を容易にする + componentconfigでの継続的な作業を通じて構成をより動的にする ▶ Goals + ComponentConfigによって設定ができるようになっている? 14 KEP: https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/785-scheduler-component-config-api

Slide 15

Slide 15 text

▶ ComponentConfig の状況(1.19時点) 15 ίϯϙʔωϯτ ରԠঢ়گ kubelet v1beta1 kube-apiserver ະରԠʁ kube-controller-manager v1alpha1 kube-proxy v1alpha1 kube-scheduler v1beta1

Slide 16

Slide 16 text

Immutable Secrets and ConfigMaps

Slide 17

Slide 17 text

▶ Immutable Secrets and ConfigMaps (beta) ▶ Summary + Immutable な Secret/ConfigMap を定義できるようになりました ▶ Motivations + アプリケーションの停⽌を引き起こす可能性のある偶発的な不正な更新から⾝ を守る + apiserverの負荷を⼤幅に削減して、クラスターのパフォーマンスを向上させる ▶ Goals + 既存の Secret/ConfigMapの偶発的な更新による問題を回避する保護メカニズム を導⼊する + クラスターのパフォーマンスを改善する 17 KEP: https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1412-immutable-secrets-and-configmapsより抜粋

Slide 18

Slide 18 text

▶ Immutable Secrets and ConfigMaps (beta)の使い⽅ ▶ Immutable フィールド + ここを true にするだけ ▶ Secret も同様 18 apiVersion: v1 kind: ConfigMap metadata: name: immutable-configmap data: key1: value1 immutable: true

Slide 19

Slide 19 text

▶ Immutable ConfigMap 更新実⾏例 19 $ kubectl patch cm immutable-configmap -p '{"data": {"key2": "value2"}}' The ConfigMap "immutable-configmap" is invalid: data: Forbidden: field is immutable when `immutable` is set $ kubectl patch cm immutable-configmap -p '{"metadata": {"labels": {"label1": "value1"}}}}' configmap/immutable-configmap patched ▶ .data 以下は immutable field 扱いになる ▶ .metadata などは変更可能

Slide 20

Slide 20 text

▶ Immutable ConfigMap の実装 20 if oldCfg.Immutable != nil && *oldCfg.Immutable { if newCfg.Immutable == nil || !*newCfg.Immutable { allErrs = append(allErrs, field.Forbidden(field.NewPath("immutable"), "field is immutable when `immutable` is set")) } if !reflect.DeepEqual(newCfg.Data, oldCfg.Data) { allErrs = append(allErrs, field.Forbidden(field.NewPath("data"), "field is immutable when `immutable` is set")) } if !reflect.DeepEqual(newCfg.BinaryData, oldCfg.BinaryData) { allErrs = append(allErrs, field.Forbidden(field.NewPath("binaryData"), "field is immutable when `immutable` is set")) } } https://github.com/kubernetes/kubernetes/blob/v1.19.2/pkg/apis/core/validation/validation.go#L5234 ΑΓൈਮ

Slide 21

Slide 21 text

まとめ

Slide 22

Slide 22 text

▶ まとめ ▶ 今回は 1.19 のリリーススケジュールが6/30 -> 8/20と変更されたこともあり変更 点は多くなりました + アップグレード時に必須な対応はほとんどない + 利⽤者向け主な変更点 + Ingress v1, seccomp GA, 廃⽌予定API利⽤の警告を表⽰する機能の追加 + 管理者向け主な変更点 + サポート期間の延⻑、構造化ロギング, KubeSchedulerConfiguration + 開発者向け主な変更点 + Betaのポリシー変更、ベースイメージ(distroless)の変更 ▶ 変更の詳細はKEPを⾒ましょう + https://github.com/kubernetes/enhancements/tree/master/keps 22

Slide 23

Slide 23 text

We are hiring! 23 Thank you for listening!