Certified Kubernetes Security Specialist (CKS)を取得しました

Kubernetes

はじめに

2021年10月頃にCKSを取りました。87点でした。

この記事では、CKS受験にあたってやったことやメモを共有します。誰かのためになれば幸いです。

なお、CKAとCKADの受験記も公開していますので、よければご覧ください。

Certified Kubernetes Administrator(CKA)を取得しました
NishipyCKAを取得しました。ひさびさの資格試験だった上、合計4時間くらい拘束されたので、とても疲れました。はじめに2020年7月にCertified Kubernetes Administrator(CKA)を取得し...(続く)
Certified Kubernetes Application Developer(CKAD)を取得しました
NishipyCKAに続き、CKADを取得しました。合計2時間以上拘束されて、とても疲れました。はじめに2020年7月末にCertified Kubernetes Application Developer(CKAD)を取得...(続く)

CKS概要

認定 Kubernetes セキュリティ スペシャリスト (CKS) | Linux Foundation
Certified Kubernetes Security Specialist (CKS) 認定は、Kubernetes プラットフォームを保護するためのベスト プラクティスに関する能力を証明します。

CKSとは、Certified Kubernetes Security Specialistの略です。Kubernetesの資格のうち、セキュリティに関連したものです。

  • Certified Kubernetes Security Specialist (CKS) プログラムとは、CKS保持者がさまざまなベストプラクティスのスキル、知識、およびコンピテンシーを備え、ビルド・デプロイ・ランタイム時にコンテナベース アプリケーションやKubernetesプラットフォームを保護できることを保証するものです。

概要はこんな感じです。

  • 受験の前提条件として、CKA合格が必要
  • 試験時間:2時間
  • 合格ライン:67%
  • 有効期限:2年間
  • ノードのOS:Ubuntu
  • 出題範囲:
    • クラスター設定 (10%)
    • クラスター強化 (15%)
    • システムの強化 (15%)
    • マイクロサービスの脆弱性を最小限に抑える (20%)
    • サプライチェーンのセキュリティ (20%)
    • モニタリング、ロギング、ランタイムセキュリティ (20%)

関連する用語のとても雑な説明

私の雑記メモから、CKSの試験に関連する用語やソフトウェア、機能などを一部紹介します。かなり雑です。

CIS Benchmark

CIS ベンチマーク  |  Google Kubernetes Engine (GKE)  |  Google Cloud
  • CIS = Center of Internet Security

Kube-bench

  • KubernetesクラスタがCIS Benchmarkのベストプラクティスを満たしているか確認するツール

Kubeadm

Upgrading kubeadm clusters
This page explains how to upgrade a Kubernetes cluster created with kubeadm from version 1.29.x to version 1.30.x, and from version 1.30.x to 1.30.y (where y > ...(続く)

Network Policy

Network Policies
If you want to control traffic flow at the IP address or port level (OSI layer 3 or 4), NetworkPolicies allow you to specify rules for traffic flow within your ...(続く)

Ingress

Ingress
Make your HTTP (or HTTPS) network service available using a protocol-aware configuration mechanism, that understands web concepts like URIs, hostnames, paths, a...(続く)

seccomp

seccomp(2) - Linux manual page
Restrict a Container's Syscalls with seccomp
FEATURE STATE: Kubernetes v1.19 Seccomp stands for secure computing mode and has been a feature of the Linux kernel since version 2.6.12. It can be used to san...(続く)
  • seccompはシステムコールを制御するフィルターとして働く、Linuxの機能の1つ
  • KubernetesではPodにseccompのプロファイルを適用することでsyscallを制御できる

Tracee

GitHub - aquasecurity/tracee: Linux Runtime Security and Forensics using eBPF
Linux Runtime Security and Forensics using eBPF. Contribute to aquasecurity/tracee development by creating an account on GitHub.
  • Aqua Security社製
  • システムやアプリケーションをトレースし、収集したイベントを解析して、疑わしい動作パターンを検出する
  • eBPFを利用している

eBPF

eBPF - Introduction, Tutorials & Community Resources
eBPF is a revolutionary technology that can run sandboxed programs in the Linux kernel without changing kernel source code or loading a kernel module.

  • Extended Berkeley Packet Filter
  • eBPFは、Linuxカーネルを起源とし、OSカーネル内でサンドボックス化されたプログラムを実行することができる技術
  • カーネルのソースコードを変更したり、カーネルモジュールをロードすることなく、安全かつ効率的にカーネルの機能を拡張するために使用される

AppArmor

Restrict a Container's Access to Resources with AppArmor
FEATURE STATE: Kubernetes v1.4 This page shows you how to load AppArmor profiles on your nodes and enforce those profiles in Pods. To learn more about how Kube...(続く)
  • Kubernetesでは、annnotationによってコンテナごとにAppArmorプロファイルを指定する

Security Contexts

Configure a Security Context for a Pod or Container
A security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to: Discretionar...(続く)
  • Podレベルまたはコンテナレベルで特権やアクセス制御を設定できる
  • 実行ユーザー(runAsUser)やケーパビリティ(capabilities)を設定
  • runAsUser: 0 : rootユーザー

OPA

GitHub - open-policy-agent/opa: Open Policy Agent (OPA) is an open source, general-purpose policy engine.
Open Policy Agent (OPA) is an open source, general-purpose policy engine. - open-policy-agent/opa
OPA Gatekeeper: Policy and Governance for Kubernetes
The Open Policy Agent Gatekeeper project can be leveraged to help enforce policies and strengthen governance in your Kubernetes environment. In this post, we wi...(続く)

Container Runtime

  • コンテナランタイム事情を整理してみる が参考になった
  • runc: もともとDockerの内部コンポーネント
  • runsc: gVisorで使われている。Kernelとコンテナを分離する
  • kata-runtime: kata-containerで使われている。各コンテナが小さいVM上で動作し、それぞれがKernelを持つ
  • Kubernetesでは、RuntimeClass を設定できる

ImagePolicyWebhook

Admission Controllers Reference
This page provides an overview of Admission Controllers. What are they? An admission controller is a piece of code that intercepts requests to the Kubernetes AP...(続く)
  • Kubernetesクラスタ上で動かすコンテナイメージを独自に制御したい場合に使える仕組み
    • latest タグを使わないなど
  • Kubernetes APIサーバを設定して、Admission Controller として追加できる

Trivy

GitHub - aquasecurity/trivy: Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more - aquasecurity/trivy
  • Aqua security社製のCVEスキャナー
  • コンテナイメージ名を指定する以外にも、tarballなどもスキャンできる

Falco

404 Page not found
Runtime Security
  • もともとSysdig社によって構築されたオープンソースのランタイムセキュリティツール
  • Falcoは実行時にカーネルからのLinuxシステムコールを解析し、強力なルールエンジンに対してストリームをアサートする。 ルールに違反した場合は、Falcoのアラートが発せられる

Auditing

Auditing
Kubernetes auditing provides a security-relevant, chronological set of records documenting the sequence of actions in a cluster. The cluster audits the activiti...(続く)
  • Kubernetes APIサーバに設定を加えることで、監査ログを取得できる
  • Policy オブジェクトを作成して、監査ポリシーを定義する

試験対策

書籍、オンライン講座、Killer.shをうまく受かって試験対策するのがよさそうです。

書籍

全体のリファレンス的なものとして、「Kubernetes完全ガイド」を使いました。

また、積読しておいた「Docker/Kubernetes開発・運用のためのセキュリティ実践ガイド」もパラパラ眺めていました。

オンライン講座

UdemyにCKS関連の講座がいくつかあります。4000円くらいで買えると思うので、やるといいでしょう。

Killer.sh (試験シミュレータ)

試験の詳細を見てみると、「Certified Kubernetes Security Specialist (CKS) に登録する受験者は、 Killer.sh が提供する試験シミュレーターを(試験登録ごとに)2回利用できます」と書いてあるのがわかります。受験前に類題を解くことができるんですが、このシミュレーターがとても勉強になります。難易度としては、実際の試験よりも少し難しめの作ってあるそうです。答えもしっかり付いているので、受験前の腕試しに最適です。書籍やオンライン講座でもいろいろ勉強しましたが、このシミュレータだけ勉強すればよかったのでは?と思ってしまいました。

試験当日

部屋の準備

自宅で受けたので、部屋を掃除しました。壁にポスターが貼ってあったりするとダメみたいですね。自分の部屋には本棚やロードバイクが置いてあるんですが、片付けなくても特に問題ありませんでした。一方で、受験時に使う机の上はかなり綺麗にしないといけません。キーボードとマウス(どちらも無線)とディスプレイとラップトップPC、あとは透明な容器に入れた飲み物以外は片付けました。

チャット

試験官と日本語のチャットができるというCKS-JPの方で申し込んでみましたが、簡単な会話しかしないのでJPである必要はないと思います。試験官も多分日本語ネイティブの方ではないので、お互い英語でやった方が会話がスムーズです。実際コミュニケーションに苦戦して30分くらい開始が遅れました。試験後に予定が入っていたりすると、地味にストレスです。

その他

その他わからないことは、FAQにだいたい書いてあるでしょう。

Frequently Asked Questions: CKA and CKAD & CKS | T&C DOCS (Candidate Facing Resources)

コメント