Peter Hunt
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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 New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # conmon 3.0 proposal: conmon-rs ## Problem It turns out the golang os.exec implementation uses a decent amount of memory, especially for single node openshift. Right now, CRI-O is responsible for a lot of exec'ing--it execs a process for essentially every runtime operation. This is charged against CRI-O in memory usage, and is the second leading cause in CRI-O RSS being high (the first being image pulling). ## Possible solutions - move to containerd shimv2 - still uses golang - update conmon to be able to spawn exec processes - writing such an application in C could get clunky, as conmon will become a server, essentially. - The conmon code is pretty fragile and changing it for this could disturb podman's needs - write a whole new conmon - :) ### Introducing podmon Note: name a work in progress--it would be a nightmare next to the comparatively more popular podman. podmon--pod monitor, would be a single process to watch over the behavior of a whole pod. It would be created as part of a RunPodSandbox request, and would listen on a unix socket for protobuf requests. The first requests it would listen for are described below: #### CreateContainer This would fulfill the previous behavior of a conmon call (without `--exec` or `--restore` arguments). It would receive a request like so: ```proto message CreateContainerRequest { string id = 1; string name = 2; string bundle_path = 3; string pid_file = 4; bool terminal = 5; bool stdin = 6; bool close_stdin = 7; repeated string log_paths = 8; repeated string exit_paths = 9; // where to write the exit files (persist-dir) repeated string runtime_args = 10: // this is where one would pass --systemd-cgroup } ``` and similarly configure the output buffers/console socket/logging drivers/OOM watchers. Instead of communicating through the sync pipe as conmon did, podmon would return the following structure: ```proto message CreateContainerResponse { uint32 container_pid = 1; string output = 2; string error = 3; } ``` Similarly, it wouldn't need the sync pipe either, as podmon would be moved to the pod's cgroup (or a dedicated slice) on pod creation. #### ExecSyncRequest ExecSync requests are for replacing the *legacy* behavior of exec--`conmon -e`. The motivation here is that CRI-O makes the most exec sync requests (to satisfy the comparatively rapid exec probes). A normal Exec (one where one can open a terminal/pass stdin in) is out of scope for the MVP. The request will look as follows: ```proto message ExecContainerRequest { string id = 1; string bundle_path = 2; string pid_file = 3; bool terminal = 4; repeated string runtime_args = 5: } ``` And the the stdout/stderr will be sent back directly, rather than through the sync pipe/through a log file: ```proto message ExecContainerResponse { string stdout = 1; string stderr = 2; string error = 3; // is there an error proto type? // yes, we can use the usual grpc return errors } ``` ### Advantages of this approach The most obvious advantage is we now only have a single exec process executed, and the vast majority of the work it does will be after it double forks: similar to how conmon worked before. However, this approach doesn't suffer from the way conmon execs did before: there's only one process for systemd to watch per pod, as opposed to an unbounded number of exec probe conmons to cleanup. Another advantage is a clean restart allows us to rethink what this runtime shim process is. conmon has existed for a long time, but has been notoriously difficult to maintain/extend. It has served well, but perhaps it is time for something new. ## Podmon holding the network namespace Today, the kubelet invokes the http probes and they aren't scoped to the pod's network. One proposal to solve this is to have the container runtime invoke the probes inside the network namespace of the pod. This can be simplified if podmon already joins the network namespace. ## Podmon as pause container for the pod level pid namespace case, we could use the new conmon as the holder of the pid namespace ## podmon as pinns? If we're already having podmon hold the net and pid namespaces, then we could also have podmon do the namespace unsharing for the pod, removing another exec. ## libraries grpc: https://github.com/hyperium/tonic We should consider communication protocols which are smaller and faster than grpc, like cap'n proto https://github.com/containers/conmon/commit/184682ba89759a91f0bc90c0ed1fdc279a6a0afb https://docs.rs/tokio/1.4.0/tokio/process/struct.Command.html#method.pre_exec # client work: - move conmon-server to correct cgroup # implement container creation - container logging - tty - no tty - runtime args processing - runtime command spawn - catch container exit - catch container oom - container timeout

    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