Skip to Content
コードとしてのポリシー
book

コードとしてのポリシー

by Jimmy Ray
March 2025
Intermediate to advanced
556 pages
9h 13m
Japanese
O'Reilly Media, Inc.
Audio summary available
Content preview from コードとしてのポリシー

第10章 クラウドカストディアンとKubernetes CloudカストディアンとKubernetes

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

巻頭言ではCloud Custodianを使ったクラウド・コンピューティングのインフラ・アズ・ア・サービスにPaCソリューションを使い始めた経緯について述べた。結局のところ、コミュニティ・メンバーの間ではc7nとして知られているCloud Custodianは、Kubernetesのユースケースもサポートしている。

C7nはPythonで書かれたオープンソースプロジェクトで、2016年にCapital Oneの人々によって作成された。私は当時キャピタル・ワンにいて、AWSアカウントにガードレールを作成するツールを探していた。c7nは、我々のチームがクラウドでの望ましくない振る舞いを防ぐのに大いに役立ったと言っても過言ではない。C7nはもともと、当社のAWSアカウントとリソースにコンプライアンスとガバナンスのコントロールを適用するために設計された。Microsoft AzureやGCPといった他のクラウドプロバイダーへのサポートは後に続き、Kubernetesもサポートされた。

c7nプロジェクトはPythonで書かれているため、ユーザや開発者は豊富なPythonエコシステムを利用することができる。 実際、私はPython用のAWS SDKであるBoto3の理解を深めるためにc7nのソースを使った。c7nのポリシー言語はYAMLベースで、kubectl explain がKubernetes APIを公開するのと同様にアクセスできる豊富なスキーマを備えている。

以下のリンクは、、c7nに関するより多くの情報を得るのに役立つ:

さっそくKubernetes用のc7n CLIツールを使ってみよう。

CLIモード

KubernetesのPaCソリューションとして、c7nにはユーザがKubernetesクラスタにインタフェースできる豊富なCLIが含まれている。 CLIを使用して、ユーザはクラスタリソースをレポートし、変更するポリシーを適用する。Kubernetesに対するC7nのサポートには、前の章で見たような動的アドミッションコントローラを使用するコントローラモードも含まれている。コントローラモードについてはこの章の後半で説明する。

PaCソリューションをKubernetesクラスタにインストールするところから始めたこれまでのソリューションとは異なり、c7nソリューションが提供する従来のアドミッション・コントロール・ツールを調べる前に、まずCLIツールを調べる。このアプローチは、c7nポリシーの最良の学習パスを提供すると思う。

さっそく、Kubernetes 1.26でc7n CLIをインストールして使ってみよう。

インストール

c7nはPythonによって支えられているので、まず必要なPythonツールをインストールする必要がある。 私は MacOSを使っている:

# get Python version
$ python3 —-version
Python 3.11.4

c7nを使うために、、Pythonの仮想環境を作成するよう勧められた: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

クラウドアプリケーションアーキテクチャパターン

クラウドアプリケーションアーキテクチャパターン

Kyle Brown, Bobby Woolf, Joseph Yoder
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9798341627093