Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
NixOSでもご自宅k8sがしたい!
Search
Yuto Takamune
July 30, 2023
Technology
5.2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NixOSでもご自宅k8sがしたい!
Yuto Takamune
July 30, 2023
More Decks by Yuto Takamune
See All by Yuto Takamune
GPT-3.5 Turbo をファインチューニングして自分のクローンを作った話
shinbunbun_
1
400
RustのLINEBot SDKを自作した話
shinbunbun_
0
2.6k
セキュリティキャンプ2023 Y3分散合意ゼミ 最終発表
shinbunbun_
0
5.1k
カーネルレベルでTwitterを禁止しよう
shinbunbun_
0
320
CRDTで始めるコンフリクトしないデータ同期
shinbunbun_
0
740
Haskell初心者がHaskellの楽しさについて語る
shinbunbun_
0
250
Rustで楕円曲線暗号の署名アルゴリズムをフルスクラッチ実装してみた話
shinbunbun_
0
2.5k
IEEE802.1X認証を導入してみた
shinbunbun_
0
350
UBICの食材管理APIを作った話
shinbunbun_
0
280
Other Decks in Technology
See All in Technology
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
360
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
5
1.2k
パッチ更新でterraform initが落ちた日
grimoh
1
140
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
290
Benchmarking Disaggregated Serving on vLLM + Dynamo with a Real Coding-Agent Workload
nttcom
1
200
FinOps Agentが生んだ技術負債:コスト自動調査の落とし穴と解消までの道のり
oasis1994liveforever
2
130
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
200
USB PDを使ってスマホを労わりたい
raspython3
0
180
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
120
専門領域のAIをどう評価するか
bengo4com
2
280
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
730
大型犬好きによるPugの紹介
yamanoku
1
160
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Making the Leap to Tech Lead
cromwellryan
135
10k
How to make the Groovebox
asonas
2
2.5k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Transcript
NixOSでもご自宅k8sがしたい! seccamp2023 LT しんぶんぶん
自己紹介 • 名前: しんぶんぶん • 所属: 会津大学学部3年 • Twitter: @shinbunbun_,
@4fa19623 • Rustいっぱいちゅき • LINE API Expert / seccamp ’23 / Cybozu labyouth 13th
みなさん、NixOS使ってますよね?
NixOSとは • 純粋関数型パッケージマネージャであるNixをベースとしたLinuxディストリビュー ション • 環境を全て宣言的に記述できる • 設定を記述する→ビルドするで適用 ◦ ビルドするたびにバージョンが発行されて、起動する際にブートローダーから任意のバージョンを選
択できる ◦ →ロールバックが容易
みなさん、おうちにk8s立てたいですよね?
NixOSでk8sを立てる • 当たり前の様にkubeadmは使えない ◦ NixOSはシステムに関する大部分が Read-Only File Systemになっており、Nix経由でしか書き換 えできない •
configuration.nixに全部書きます • 逆にいえば、nix書くだけでk8sが立ち上がる • 今回はmaster1台でお試ししてみる
None
はい、これでクラスタ立ちました
NixOS最高!!!
せっかくだからNodeをもう一つ立ててみる
None
これで完成
せっかくだから最近流行りのMisskey立ててみよう
Misskeyを立てる • 公式のHelmはボリューム周りの問題でなぜか動かなかったので、自分でマニフェ ストを書く • 参考: https://4nm1tsu.com/posts/4pdgkbc/ • Nodeが1台なので、ローカルのストレージを使用
まずはDB
• Secret, SVC, PV, PVC, Podを作成
次にredis
• SVC, PV, PVC, Podを作成
最後にWebサーバ
• PV, PVC, SVC, Deploymentを作 成
最後にCloudflare Tunnel
None
applyすれば完成!
が、ここで1つ問題が...
なぜかsvcが名前解決できない • 原因を調べてみると、Kubernetes API Serviceへのアクセスが失敗している • iptablesとか色々見たりして無限時間溶かした
結局原因は... • Firewallでした • Kubernetes APIサーバは普通Podとしてクラスター内に立っているらしいが、 NixOSで構築するとクラスター外部にAPI Serverが立つ • Podからローカルネットワークへのアクセスは、すなわち外部ネットワークからロー
カルネットワークへのアクセスと同じ • ということは、API Serverが立っているポートへの外部からのアクセスをFirewallで 許可しないといけなかった
これで終わり
まとめ • NixOSだと超簡単にk8sクラスタを構築できる • Misskeyも割と簡単に立つ