kalug
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: "kind: kubernetes in docker" pubDatetime: 2025-01-16T19:30:00+08 tags: - meetup - kubernetes - kind - podman description: "let's run kind in podman" youtube: b-b9Nahro9w luma: dt8l2tnm googlemap: omXnciLVyBBzHcLXA meetupLocation: Second space 捷運中央公園站 三號出口 R9 Exit 3 --- [![hackmd-github-sync-badge](https://hackmd.io/o6XKOGGyREyfbxsSDNveJg/badge)](https://hackmd.io/o6XKOGGyREyfbxsSDNveJg) 本次活動我們會在 second space 與 線上同時舉行 上次 Johnny 幫我們介紹 本地端 如何建 kubernetes, 而 單純 本地測試 還有一個更輕量的選擇 kind Shawn 打算介紹如何使用 用 podman 使用 kind, 以及 podman 一些好用的功能如: - podman kube - daemonless / quadlet - podmansh --- # kind ### kubernetes in docker (or podman) :::info 2025/01 KaLUG.tw meetup / Shawn 👉[youtube](https://www.youtube.com/watch?v=b-b9Nahro9w) / [github demo code](https://github.com/kalug/kind-demo)👈 ::: :::danger ⚡ Don't use for PRODUTION env ⚡ ::: ---- # Outline * what's kind? * other choices * inside kind - docker in docker - LoadBalancers - cloud-provider-kind :::info 👍 using kind for dev or testing ::: --- ## What's kind - Kubernetes in Docker https://kind.sigs.k8s.io/ - Go packages implementing cluster creation, image build, etc. - A command line interface (kind) built on these packages. - Docker image(s) written to run systemd, Kubernetes, etc. - kubetest (WIP) ---- ### Deep Dive: Kind Nov 22, 2019 {%youtube tT-GiZAr6eQ%} ---- ### Deep Dive: Kind * test kubernetes * E2E testing * 7:30 Networking Deep Dive (kindnet) ---- ### Testing your K8s apps with KIND May 24, 2019 {%youtube 8KtmevMFfxA %} ---- ### Quick start https://kind.sigs.k8s.io/docs/user/quick-start/ ``` # fetch release binary curl -Lo ~/bin/kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64 && chmod +x ~/bin/kind ``` ``` $ kind create cluster ``` ``` $ kind get clusters kind ``` ``` $ kubectl get nodes -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME kind-control-plane Ready control-plane 52s v1.32.0 10.89.0.2 <none> Debian GNU/Linux 12 (bookworm) 6.13.0-0.rc1.20241206gitb8f52214c61a.19.fc42.x86_64 containerd://1.7.24 ``` ---- ### What is a kubernetes ![k](https://kubernetes.io/images/docs/components-of-kubernetes.svg) ---- ### What is a kind cluster? - kind nodes ``` $ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 13b1bfcafa48 docker.io/kindest/node@sha256:c48c62eac5da28cdadcf560d1d8616cfa6783b58f0d94cf63ad1bf49600cb027 3 minutes ago Up 3 minutes 127.0.0.1:37513->6443/tcp kind-control-plane ``` ``` $ podman exec -it kind-control-plane bash root@kind-control-plane:/# systemctl status kubelet.slice ● kubelet.slice - slice used to run Kubernetes / Kubelet Loaded: loaded (/etc/systemd/system/kubelet.slice; static) Active: active since Wed 2024-12-25 14:25:51 UTC; 5min ago Tasks: 174 Memory: 460.4M CPU: 26.736s CGroup: /kubelet.slice ├─kubelet-kubepods.slice ... ``` ---- ### containers in kind node ``` ctr -n k8s.io c ls CONTAINER IMAGE RUNTIME 0cc5dbdf2b34ff037bae5693ee6e64d3c9cb9f8ae32ab153d0e6cdc8a12eebd2 registry.k8s.io/pause:3.10 io.containerd.runc.v2 2584e9ca5a3c9725b76539ee7e736adee1c287ccd8d55031f5afdf9fa6c3390d registry.k8s.io/kube-apiserver-amd64:v1.32.0 io.containerd.runc.v2 37104ddf07cf3ce0bc8b56659d7a17304f017b6d4ce652301a91e5324b9cf82a registry.k8s.io/kube-proxy-amd64:v1.32.0 io.containerd.runc.v2 3f8dfdd4eac682e21a082eb89f6ff98f37cf666e1cc93be7b1bbdfd3b0dff320 registry.k8s.io/kube-scheduler-amd64:v1.32.0 io.containerd.runc.v2 ... ``` --- # Others? Kind < k3d < minikube ---- | | features | vm | vendor | LB | | -------- | -------- | -------- | ------ | --- | | kind | lite | no | sig-testing | cloud-provider-kind | | minikube | full features | yes | sig-cluster-lifecycle | mikikube tunnel | | kubeadm | - | - | Kubernetes | - | | k3d | k3s | - | k3s | via Ingress (recommended) | | microk8s | snap | yes | canonical | MetalLB | | [capid](https://cluster-api.sigs.k8s.io/) | cluster-api | no | sig-cluster-api | | ---- ## tips: ### kubie A more powerful alternative to kubectx and kubens https://github.com/sbstp/kubie - Shell prompt modification - Split configuration files - kubie exec ### known-issues - https://kind.sigs.k8s.io/docs/user/known-issues/ - like max_user_instances --- ## Inside kind - privileged mode - Docker in Docker - systemd in Docker - load --- ### Docker in Docker #### container inside container - \-\-privileged - Linux Security Modules - AppArmor or SELinux ---- #### privileged mode https://learn.snyk.io/lesson/container-runs-in-privileged-mode/ ---- ### systemd in Docker ``` from debian:11 run apt -y update run apt -y install systemd # first tell systemd that it is in docker (it will check for the container env) # https://systemd.io/CONTAINER_INTERFACE/ ENV container=docker # systemd exits on SIGRTMIN+3, not SIGTERM (which re-executes it) # https://bugzilla.redhat.com/show_bug.cgi?id=1201657 STOPSIGNAL SIGRTMIN+3 # NOTE: this is *only* for documentation, the entrypoint is overridden later RUN passwd -d root ENTRYPOINT [ "/lib/systemd/systemd" ] ``` ---- ## more deeper - kubelet - https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/ - kubeadm - - kubelet plugin - nvkind - https://github.com/NVIDIA/nvkind/ - cri-o in kind ---- ### kubeadm https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/ ---- cri-o in kind https://github.com/cri-o/cri-o/blob/main/tutorials/crio-in-kind.md --- ### kindnet CNI - https://github.com/containernetworking/cni - cni/net.d/10-kindnet.conflist --- ### LoadBalancers - cloud-provider-kind https://kccnceu2024.sched.com/event/1YhhY https://github.com/kubernetes-sigs/cloud-provider-kind {%youtube U6_-y24rJnI %} ---- ### cloud-provider-kind - one service one kindccm ``` podman ps a0a8b3c02bab docker.io/envoyproxy/envoy:v1.30.1 bash -c echo -en ... About an hour ago Up About an hour 0.0.0.0:40617->10000/tcp kindccm-KDNZI53UFUSNY4WSWHFWVBBUZDBQ3EQ5KR66Y5RJ ``` ---- * kubectl port-forward service/doc-controller 8080:8080 https://kccnceu2024.sched.com/event/1YhhY/keep-calm-and-load-balance-on-kind-antonio-ojea-benjamin-elder-google ---- ## Other tips - Local Registry - kubie ---- ## nvkind - https://github.com/NVIDIA/nvkind/ - https://github.com/NVIDIA/k8s-device-plugin/ - https://www.youtube.com/watch?v=jnHlwZKJiL4 - docker only {%youtube jnHlwZKJiL4 %}

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully