Humble Devassy Chirammal
    • 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
    • Make a copy
    • 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 Make a copy 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
    # inline volume support for Ceph CSI driver **What is it all about ?** Traditionally, volumes that are backed by CSI drivers can only be used with a PersistentVolume and PersistentVolumeClaim object combination. Two different Kubernetes features allow volumes to follow the Pod's lifecycle: CSI ephemeral volumes and generic ephemeral volumes. In both features, the volumes are specified directly in the pod specification for ephemeral use cases. At runtime, nested inline volumes follow the ephemeral lifecycle of their associated pods where Kubernetes and the driver handle all phases of volume operations as pods are created and destroyed. CSI ephemeral Inline volume spec example: ``` kind: Pod apiVersion: v1 metadata: name: my-csi-app spec: containers: - name: my-frontend image: busybox volumeMounts: - mountPath: "/data" name: my-csi-inline-vol command: [ "sleep", "1000000" ] volumes: - name: my-csi-inline-vol csi: driver: <drivername> volumeAttributes: something: something ``` General inline ephemeral support example: ``` kind: Pod apiVersion: v1 metadata: name: some-pod spec: containers: ... volumes: - name: scratch-volume ephemeral: volumeClaimTemplate: metadata: labels: type: my-frontend-volume spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "scratch-storage-class" resources: requests: storage: 1Gi ``` To support above inline ephemeral support in ceph csi , there are some changes required or incorporated in our Driver: ( RBD driver has been mentioned as a reference here) | Volume Attributes | NodePublishSecretReference | Workflow Changes | | -------- | -------- | -------- | | Section 1 | Section 2 | Section 1 | ## **Section 1:** Volume Attributes we have to define the required parameters in the volumeAttributes section. The identified volume attributes for Ceph RBD driver are: VolumeAttributes: - [x] clusterID - [x] pool - [x] imageFeatures Secret: - [x] nodePublishSecretRef: See section 2 for more infomration on this secret and our driver The volumeHandle will be created and delivered to the RBD driver when inline volume spec has been mentioned, these volumes specified above is "persistent" types (v1.CSIPersistentVolume) volumes by default. That said, the volumes are persisted across the pod restarts and could have the same working mechanism of general provisioning done by the CSI driver. However there is an option left to the user who can specific "ephemeral" volume type (v1.CSIPersistentVolume) while defining the volume. ``` // VolumeLifecycleModes defines what kind of volumes this CSI volume driver supports. // The default if the list is empty is "Persistent", which is the usage // defined by the CSI specification and implemented in Kubernetes via the usual // PV/PVC mechanism. // The other mode is "Ephemeral". In this mode, volumes are defined inline // inside the pod spec with CSIVolumeSource and their lifecycle is tied to // the lifecycle of that pod. A driver has to be aware of this // because it is only going to get a NodePublishVolume call for such a volume. // For more information about implementing this mode, see // https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html // A driver can support one or more of these modes and // more modes may be added in the future. // +optional VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"` ``` The logic of handling inline ephemeral volumes should work with a bit of different workflow. IOW, the RBD CSI driver has to be adjusted to have this work flow mainly in 2 RPC calls. *) Node Publish While CSI RBD driver recieve the node publish call with inline volume spec, the driver has to "also take care createVolume operations". After sucessful completion, the driver has to continue the node operations ( stage , publish) *) Node Unpublish while CSI RBD driver receive the node Unpubish call with inline volume spec, the driver has to "also take care of deleteVolume operations". After successful node operations ( like unmount, unstage), the driver has to continue the operations for deletion of the volume The idempotency of above operations has to be carried out from the CSI RBD driver with the proper locking in place, for example, creation/deletion... locks has to be held on the volume Handle while performing the operations... The NodePublishVolume request also carry general args such as "fs_type" which can be made use of from the csi driver. ## **Section 2:** NodePublishSecret This secret has to carry the user who have permissions to create, delete, mount and unmount volumes on this request. The secret reference declared in an ephemeral inline volume can only be used with namespaces from pods where it is referenced. The NodePublishSecretRef is stored in a LocalObjectReference value: LocalObjectReference do not include a namespace reference. This is to prevent reference to arbitrary namespace values. The namespace needed will be extracted from the the pod spec by the Kubelet code during mount. As this secret is also required in nodeunstage operation to delete the volume, this has to be part of the CSI PV nodestage operations. ## **Section 3:** Workflow changes or Code Changes **NodeServer changes:** Based on the volumeLifecycleModes, the driver has to introduce the call to createVolume based on the volumeContext passed in the nodePulishVolume Call. The NodePublish call should intercept or identify the ephemeral inline request as an example shown below: ``` NodePublish() ephemeralVolume := req.GetVolumeContext()["csi.storage.k8s.io/ephemeral"] == "true" || req.GetVolumeContext()["csi.storage.k8s.io/ephemeral"] == "" && ns.ephemeral // Kubernetes 1.15 doesn't have csi.storage.k8s.io/ephemeral. .... // if ephemeral is specified, create volume here to avoid errors if ephemeralVolume { createVolume().. continue with node operations.. } ``` NodeUnpublish() ``` if vol.Ephemeral { continue with node operations.. deleteVolume() } ``` **CSI driver object changes** The CSI driver object has to be carry the lifecycle mode it support. ``` // VolumeLifecycleMode is an enumeration of possible usage modes for a volume // provided by a CSI driver. More modes may be added in the future. type VolumeLifecycleMode string const ( // VolumeLifecyclePersistent explicitly confirms that the driver implements // the full CSI spec. It is the default when CSIDriverSpec.VolumeLifecycleModes is not // set. Such volumes are managed in Kubernetes via the persistent volume // claim mechanism and have a lifecycle that is independent of the pods which // use them. VolumeLifecyclePersistent VolumeLifecycleMode = "Persistent" // VolumeLifecycleEphemeral indicates that the driver can be used for // ephemeral inline volumes. Such volumes are specified inside the pod // spec with a CSIVolumeSource and, as far as Kubernetes is concerned, have // a lifecycle that is tied to the lifecycle of the pod. For example, such // a volume might contain data that gets created specifically for that pod, // like secrets. // But how the volume actually gets created and managed is entirely up to // the driver. It might also use reference counting to share the same volume // instance among different pods if the CSIVolumeSource of those pods is // identical. VolumeLifecycleEphemeral VolumeLifecycleMode = "Ephemeral" ) ``` [Add details for below] missing secret in the NodeUnstage which is required for cleanup Generation/deriving the rbd image/cephfs subvolume name Storing of the volume/mount-related pieces of information which are required for delete/unmap operations.

    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