MLエンジニアがKubernetesを学ぶべき理由
ハメル・フサイン氏は、ML エンジニアが Kubernetes の学習に投資すべき理由として、インフラ制約からの脱却やチームとの円滑な対話、トラブルシューティング能力の向上を挙げている。
キーポイント
ホスト型ツールの限界と代替手段
クラウドプロバイダーが提供する ML インフラは万能ではなく、オープンソースやサードパーティ製ツールが必要になる際、K8s の基礎知識がデプロイやトラブルシューティングに不可欠となる。
自己責任の文化とインフラ制約
組織内で十分なツールが用意されていない場合、ML エンジニア自身が環境構築や問題解決を行う必要があり、K8s の知識がその際の強力な武器となる。
チーム間の生産的な対話
インフラの基本概念を理解することで、開発者や運用担当者とより効果的にコミュニケーションを取り、プロジェクトを円滑に進めることができる。
DevOps チームへの負担軽減と協力の促進
ML エンジニアが基本的な Kubernetes のスキルを持つことで、慢性的に人手不足の DevOps チームの負担を大幅に減らし、インフラ支援を得やすくなります。
ソフトウェアエンジニアリング能力での差別化
ML 研究は競争が激しく混雑しているため、最新のアルゴリズムよりもモデルを実運用する SWE(ソフトウェアエンジニアリング)スキルを持つことで他と差別化できます。
クラウドインフラの共通言語としての地位
Kubernetes は CNCF 調査で組織の96%が利用・検討しており、データサイエンスにおける Python のように、インフラ担当者との対話や支援獲得のための共通言語となっています。
Kubernetes は過剰ではない
単純なプロトタイプには過剰だが、多くの企業ではセキュリティやコスト管理のガバナンスが K8s パターンに基づいて構築されており、その環境でツールを運用するには K8s の知識が必要不可欠である。
影響分析・編集コメントを表示
影響分析
この記事は、ML エンジニアが純粋なモデル開発だけでなく、インフラ運用面でもスキルを高めるべきという現実的な課題提起を行っています。Kubernetes の学習コストに見合うリターンとして、現場での自律性と問題解決能力の向上を強調しており、キャリア形成における重要な指針となります。
編集コメント
モデル開発のスキルだけでなく、運用基盤(MLOps)への理解が現代の ML エンジニアには必須であるという視点を提供しており、キャリアアップを目指すエンジニアにとって非常に示唆に富んでいます。
もしコースを探してここに訪れたのであれば、以下のセクションへお進みください:データサイエンティスト向け K8s。
Kubernetes(略称:K8s)は、クラウド上でコンテナ化されたアプリケーションをデプロイおよび管理するためのオープンソースシステムです。現代の Web アプリケーションのうち、K8s 上でデプロイされる割合は年々増加しています。もしあなたが機械学習エンジニアであれば、モデルのトレーニング、監視、オーケストレーションに使用するインフラストラクチャが K8s 上にデプロイされているか、あるいはあなたのモデルを利用する下流アプリケーションが K8s で稼働している可能性が高まっています。ただし、K8s は学習が難しい複雑なシステムでもあります。
Chip Huyen の意見には理論上は同意します。データサイエンティストが K8s を学ぶ必要はないはずです。しかし、現実には:学ぶべきではないとしても、実際に学んでおくことは非常に有益です!私はしばしばインフラストラクチャの制約に直面しており、そのインフラストラクチャが Kubernetes 上でホストされるケースが増えていると感じています。
例えば、クラウドプロバイダーのコンソールへのアクセス権限を rarely 与えられることが多く、代わりにすでにいくつかのデータツールがインストールされた K8s クラスターへのアクセス権限しか得られません。何か問題が発生した際、K8s について十分な知識があれば、その問題をデバッグするのに役立ちます。また、基本的な概念に精通しておくことで、チームとのインフラストラクチャに関する議論をより生産的なものにできます。
Vicki Boykis も、この技術を学ぶための投資は価値があると考えています1:

以下に、機械学習エンジニアが K8s を学ぶことが良いアイデアである理由をいくつか挙げます2。
ホスト型データ/ML ツールが常に選択肢とは限らない

科学者を案内するロボットコンシェルジュ
大規模クラウドプロバイダーは、自社の ML インフラストラクチャをホスト型ソリューションとして提供しています3。しかし、これらの提供物と機械学習チームのニーズの間には、しばしばギャップが存在します。例えば、私は以下のようなツールが、ホスト型ソリューションに併設または代替として導入されているのを目にしたことがあります:
オープンソースだけでは不十分な場合、サードパーティベンダーは喜んで自社のソフトウェアをあなたのクラウド上にインストールしてくれます。しかし、これを実現するには、基本的なインフラストラクチャのスキルが必要となるケースが多々あります。これらのスキルは Kubernetes と重なる部分が多いです。ご自身が直接インフラストラクチャをデプロイする責任を負わない場合でも、仕組みの基本を理解しておくことは、基本的なデバッグやトラブルシューティングを行う上で役立ちます。例えば、ログや API/HTTPS エンドポイントの場所を知っていれば、多くのケースで作業が円滑に進むようになります。
誰かが救いに来てくれるわけではない

機械学習のプロフェッショナルとしての最初の経験として、作業を開始するために必要なツールが揃っていないという状況に直面することがよくあります。これは非常にフラストレーションを感じるもので、適切なツールなしで進捗を出すのは難しいからです。この経験は通常、以下のような会話へと発展します:
ML エンジニア:ACME 社への参加を楽しみにしています!予測モデルを使ってマーケティング支出の最適化を任されました。しかし、効率的に業務を行うために必要な基本的なインフラストラクチャやツールが不足しているのが課題です。
マネージャー:混乱しています。必要なツールをインストールできないのですか?それがあなたの役割ではないですか?あなたが解決してくれるものだと思っていました。
ML エンジニア:いいえ、インフラのセットアップやデプロイの方法は知りません。それには特別なインフラ担当者または DevOps 担当者が必要です。
マネージャー:投資対効果(ROI)が不明確な状態で追加リソースを要求するのは難しいでしょう。まず ML プロジェクトを実行して価値を示し、その後でインフラへの投資を検討しましょうか?
ML エンジニア:より迅速に実験を行い、概念実証(PoC)を開発するために最低限のツールが必要です。また、チームとの協力を改善するのに役立つツールも必要です…
私の経験では、DevOps チームは慢性的な人員不足と過重労働に悩まされています。セキュリティ上の懸念から、企業向けソフトウェアを自分で Kubernetes 上でデプロイするのは通常推奨されませんが、基本的なスキルを持っていれば、DevOps の同僚たちの負担を劇的に軽減し、彼らがあなたを支援しやすくすることができます。
Kubernetes(K8s)はインフラの問題に対する万能薬ではありません。組織の制約や既存のソフトウェアスタックの範囲内で運用する必要があります。4 しかし、その人気が高まるにつれて、この技術を学ぶことがますます有益になる可能性が高まっています。
ML 研究は過密化しています。SWE(ソフトウェアエンジニアリング)スキルで競争しましょう。

科学者で溢れかえった部屋
データサイエンティストとして他と差別化を図る最良の方法の一つは、あなたのスキルです。従来の教育では最新の機械学習(ML)技術の習得に重点が置かれる傾向があります。しかし、最先端の ML 研究は非常に競争が激しく、すでに過密な領域となっています。
私の経験則では、多くのチームが直面しているボトルネックは、最先端の ML 技術に関する知識の欠如ではなく、モデルを実運用化するためのソフトウェアエンジニアリングスキルやパートナーシップの不足です。ツールやインフラストラクチャを構築する方法を学ぶ時間を少し取れば、あなたはチームにとって不可欠な存在となるでしょう。
さらに重要なのは、機械学習をビジネス課題に結びつけるために、モデルをサービスやアプリケーションにデプロイし統合することが極めて重要だということです。Kubernetes(K8s)を学ぶことは、この目的を達成する助けとなります。
あなたの会社はすでに Kubernetes を運用しているはずです

インフラストラクチャを担当する人物と握手をする科学者
Python がデータサイエンスの共通言語であるように、Kubernetes(K8s)もクラウドインフラストラクチャの共通言語になりつつあります。CNCF による 2021 年の調査によると、組織の 96% が Kubernetes を使用しているか、評価中であると回答しています。さらに、Stack Overflow の 2022 年開発者調査では、Docker と Kubernetes がそれぞれ「最も愛され、欲しいツール」の第 1 位と第 2 位にランクインしました。これは、Kubernetes(K8s)が定着する強い指標です。
Kubernetes(K8s)に関する基本的な習熟度は、多くの組織において望むツールのサポートを得る可能性を劇的に高めます。Kubernetes(K8s)の習熟度が高まると、以下の確率が向上します:
あなたの DevOps の同僚たちは、あなたがデプロイしたいツールに慣れ親しんでいると感じるでしょう
アプリケーション管理者と共通の言語で対話できるようになります
インフラのサポートをしてくれる人材を引きつける可能性が高まります
これらの要因により、データサイエンスの経験がないソフトウェアエンジニアが「良いアイデア」と考えるものではなく、あなたが現在いる場所に合わせて提供されるツールを手に入れる可能性が格段に高まります(私はこれが頻繁に起こるのを何度も見てきました!)。
しかし、それはやりすぎではないでしょうか?

チェーンソーでオレンジを切る
素早く立ち上げたりプロトタイプを作成したりしたいシンプルなアプリケーションの場合、K8s はやりすぎです。むしろ、多くの企業で見られる環境内で作業する際に K8s の知識が有用であると主張しています。例えば、データ製品を単一の VM でホストすることは、本番ソフトウェアをデプロイしたい場合、しばしば不十分です。多くの企業では、Kubernetes しか含まない舗装されたパス(paved paths)のみで構成されるインフラにより、そのようなことができないように制限されていることもあります。
本番ソフトウェアをデプロイしていなくても、必要なツールをデプロイする際に K8s は非常に貴重な役割を果たすことができます。多くの場合、K8s を使用することでタスクが容易になります。大企業はコストとセキュリティを管理するためのガードレールを作成するために必然的にリソースを投資してきました。これらのガードレールはますます Kubernetes パターン(Kubernetes patterns)を中心に構築されています。これらの概念を理解することは、自社のクラウドスタックの制約内で運用するのを容易にします。
あなたは専門家である必要はありません

図書館の机に座っている学生
K8s は複雑ですが、データサイエンティストとして大きな価値を引き出すために、専門家になる必要はありません。データサイエンティストが K8s の管理者になることを提案しているわけではありません。K8s 管理は非常に手間のかかるタスクであり、それ自体が一つの役割として成立するほど重要です。残念ながら、K8s に関する教育資料のほとんどは管理者向けに焦点を当てており、多くのデータサイエンティストが必要とするところには過剰対応となっています。
データサイエンティストのような人々が、管理者向けの無関係な資料を読み漁ることなく Kubernetes を学ぶための良いリソースをまだ見つけていません。そこで、私と私の同僚たちは、データサイエンティストを意識した無料コースの作成を検討しています。これが興味深いと思われる場合は、こちらから登録してください。
ヴィッキーは派手な新技術に感銘を受けるタイプではなく、実用的なアプローチで仕事を完遂する人物です。彼女が K8s を学ぶべきだと言うなら、あなたは耳を傾けるべきです!↩︎
この記事の各サブセクションには、画像キャプションと非常に似たプロンプトを使用して Stable Diffusion で生成された画像が含まれています。↩︎
これらのシステムは、AWS の Sagemaker、Azure の AzureML、GCP の VertexAI です。↩︎
一部の組織では K8s を回避するソリューションを構築しています。例えば、BigHat は AWS SageMaker と Lambda を組み合わせたソリューションやその他のホスト型ソリューションを使用しています。そのため、そのような例で無理に K8s へ移行しようとすることは間違いかもしれません。可能であれば、自社の既存の技術スタックを活用するように努めるべきです!↩︎
ML インフラストラクチャを専門とする友人のミハル・ヤストレンブスキは、私に次のような色鮮逸なエピソードを教えてくれました:「データサイエンティストが K8s を学ぶべきではない」と言うのを聞くと、「DevOps が Airflow を学ぶ必要がある」と言っているように聞こえます。↩︎
具体的に関連する K8s の概念としては、名前空間(namespaces)、ラベル(labels)、および RBAC(ロールベースアクセス制御)があります。↩︎
原文を表示
If you came here looking for the course, feel free to jump ahead to: K8s For Data Scientists.
Kubernetes, known as K8s, is an open-source system for deploying and managing containerized applications in the cloud. An increasing amount of modern web applications are deployed on K8s. If you are an ML engineer, it is increasingly likely that either the infrastructure you use to train, monitor, or orchestrate your models is deployed on K8s, or downstream applications that consume your models are running on K8s. However, K8s is a complex system that can be intimidating to learn.
I agree with Chip Huyen that, in theory, Data Scientists shouldn’t need to learn K8s. However, the truth is: Even though you shouldn’t have to, it’s really beneficial if you do! I’ve found that I’m often constrained by infrastructure and that infrastructure is increasingly hosted on Kubernetes.
For example, I’m rarely given access to a cloud provider’s console, and instead, I have access to a K8s cluster with some data tools already installed. When something goes awry, it’s beneficial to know enough about K8s to debug the issue. Additionally, familiarity with basic concepts allows me to have more productive conversations with my team about infrastructure.
Vicki Boykis seems to agree that the investment in learning this technology is worthwhile1:

Below, I outline several reasons why learning K8s is a good idea for machine learning engineers2.
Hosted data/ML tools are not always an option

A robot concierge helping a scientist
Large cloud providers offer their flavors of ML infrastructure as hosted solutions3. However, there is often a gap between these offerings and the needs of machine learning teams. For example, I’ve seen the following tools deployed alongside or in place of hosted solutions:
When open source isn’t enough, third-party vendors are happy to install their software on your cloud. However, you often need basic infrastructure skills to enable this. These skills often intersect with Kubernetes. While you may not be responsible for deploying the infrastructure yourself, it is helpful to understand the basics of how things work so that you can do basic debugging and troubleshooting. For example, knowing where to find logs or an API/HTTPS endpoint can unblock you in many cases.
Nobody is coming to save you

A typical first experience as a machine learning professional is that you don’t have the necessary tools to get started. This is incredibly frustrating, as making progress without the proper tools can be hard. This experience usually culminates in a conversation like this:
ML Eng: I’m excited to join ACME company! You’ve hired me to optimize marketing spending with predictive models. The issue is that we don’t have the basic infrastructure or tools necessary for me to work efficiently.
Manager: I’m confused. Can’t you install the tools you need? Isn’t that what you are for? I was expecting that you would figure it out.
ML Eng: No, I don’t know how to set up and deploy infrastructure. We need a special infrastructure or DevOps person for that.
Manager: It will be hard to ask for more resources if we don’t know the expected return on investment. Can you do the ML project first, demonstrate some value, and then we can invest in infrastructure?
ML Eng: I need some minimum tools to experiment more quickly and develop a proof of concept. Also, I need tools that might help me collaborate better with my team…
My experience is that DevOps teams are chronically understaffed and overworked. While it usually isn’t advisable to deploy enterprise software yourself on Kubernetes for security concerns, having basic skills can lift a tremendous burden off your DevOps counterparts and make it tractable for them to help you.
K8s are not a panacea for all infrastructure problems. You must operate within the constraints of your organization and existing software stack.4 However, with its growing popularity, it is increasingly likely that learning this technology will help you.
ML research is crowded. Compete on SWE skills.

An overcrowded room of scientists
One of the best ways to set yourself apart as a data scientist is through your skills. Traditional education often emphasizes learning the latest ML techniques. However, cutting-edge ML research is very competitive. It’s also an extremely crowded space.
In my experience, the bottleneck many teams face is not a lack of knowledge of cutting-edge ML techniques but software engineering skills and partners to help operationalize models. If you take some time to learn how to stand up tools and infrastructure, you will be invaluable to your team.
More importantly, deploying and integrating models into services and applications is critical to connecting ML to business problems. Learning K8s will help you do this.
Your company likely already runs K8s

A scientist shaking hands with someone who runs infrastructure
Just as Python is the lingua franca of data science, K8s is becoming the lingua franca of cloud infrastructure. According to a 2021 Survey by CNCF, 96% of organizations are either using or evaluating Kubernetes. Furthermore, Stack Overflow’s 2022 Developer Survey shows that Docker and Kubernetes are the number one and two most loved and wanted tools, respectively. This is a strong indicator that K8s are here to stay.
Basic proficiency with K8s will drastically increase your chances of garnering support for your desired tools in many organizations. Proficiency with K8s increases the likelihood that:
Your DevOps counterparts will feel comfortable with the tools you want to deploy
You will have a shared language in which to talk to your application administrators
You will be more likely to attract people to help you with infra 5
These factors make it much more likely that you will get the tools that meet you where you are as opposed to something a software engineer without any data science experience thinks is a good idea (which I’ve seen happen a lot!).
But isn’t it overkill?

Cutting oranges with a chainsaw
For simple apps that you want to stand up quickly or prototype, K8s is overkill. Instead, I’m advocating knowledge of K8s as useful when working within the environments found in many companies. For example, hosting your data product on a single VM is often insufficient if you want to deploy production software. Many companies even have infrastructure that may block you from doing this with paved paths that only include Kubernetes.
Even if you are not deploying any production software, K8s can be invaluable in allowing you to deploy the tools you need. In many cases using K8s can make tasks easier. Enterprises have necessarily invested resources in creating guardrails to control costs and security. Those guardrails are increasingly built around K8s patterns6. Understanding these concepts can make operating within the confines of your company’s cloud stack easier.
You don’t need to be an expert

A student sitting at a desk in a library
K8s are complicated, but you don’t need to become an expert to unlock great value as a Data Scientist. I’m not suggesting that data scientists become K8s administrators. K8s Administration is a very involved task and worthy of its own role. Unfortunately, nearly all educational material around K8s is focused on being an administrator, which is overkill for what most data scientists need.
I haven’t yet found a good resource for people like data scientists to learn Kubernetes without wading through lots of irrelevant material geared towards administrators. So my colleagues and I are considering creating a free course with data scientists in mind. If this sounds interesting, you can sign up here.
Vicki is not someone who is impressed by flashy or new technologies and is someone who takes a pragmatic approach to get the job done. When she says you should learn K8s, you should pay attention!↩︎
Each subsection of this article has a picture that has been generated by Stable diffusion with a prompt that very similar to the image caption.↩︎
These systems are AWS - Sagemaker, Azure - AzureML and GCP - VertexAI.↩︎
Some organizations have built solutions that avoid K8s. For example, BigHat uses a solution based on AWS SageMaker + Lambda and other hosted solutions. So it might be a mistake to try to move over to K8s in that example – you should try to leverage your company’s existing tech stack where possible!↩︎
My friend Michał Jastrzębski, who specializes in ML infrastructure, has shared the following colorful anecdote with me: “when I hear Data Scientists shouldn’t learn K8s”, I hear “DevOps needs to learn Airflow”.↩︎
Specifically, K8s concepts that are relevant are namespaces, labels and RBAC.↩︎
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み