Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to run with podman in rootless mode using cgroups v2 #1084

Merged
merged 3 commits into from
Jun 15, 2022

Conversation

gonzalesraul
Copy link
Contributor

What

Fix running k3d with podman and cgroups (v2)

Why

  • By running podman in rootless mode, k3d/k3s requires extra delegation in order to work (cpu, cpuset and I/O delegations), added the steps to the doc. Some errors like failed to find cpu cgroup (v2) would happened on cgroup v2 and cpu delegation not enabled ([BUG] rootless docker -> k3d blocks forever (k3s boot loops) #585)

  • Podman is API compatible with docker, however there is a slightly difference on network retrieval of IP address. One uses only CIDR notation (127.0.0.1/32) while the other, for unique IP address use the literal notation (127.0.0.1). Create a wrapper function to extract the value instead of throwing an error.

    The following happened before the fix (netaddr.ParseIPPrefix("11.89.1.4"): no '/' )

    ❯ k3d cluster create testing
    INFO[0000] Prep: Network                                
    INFO[0000] Created network 'k3d-testing'                
    INFO[0000] Created image volume k3d-testing-images      
    INFO[0000] Starting new tools node...                   
    INFO[0000] Starting Node 'k3d-testing-tools'            
    INFO[0001] Creating node 'k3d-testing-server-0'         
    INFO[0001] Creating LoadBalancer 'k3d-testing-serverlb' 
    INFO[0001] Using the k3d-tools node to gather environment information 
    INFO[0002] HostIP: using network gateway 10.89.1.1 address 
    INFO[0002] Starting cluster 'testing'                   
    INFO[0002] Starting servers...                          
    INFO[0002] Starting Node 'k3d-testing-server-0'         
    INFO[0007] All agents already running.                  
    INFO[0007] Starting helpers...                          
    INFO[0007] Starting Node 'k3d-testing-serverlb'         
    ERRO[0015] Failed Cluster Start: error during post-start cluster preparation: failed to get cluster network k3d-testing to inject host records into CoreDNS: failed to parse IP of container k3d-testing: netaddr.ParseIPPrefix("11.89.1.4"): no '/' 
    ERRO[0015] Failed to create cluster >>> Rolling Back    
    INFO[0015] Deleting cluster 'testing'                   
    INFO[0016] Deleting cluster network 'k3d-testing'       
    INFO[0016] Deleting 3 attached volumes...               
    WARN[0016] Failed to delete volume 'k3d-testing-images' of cluster 'testing': docker failed to delete volume 'k3d-k3s-default-images': Error response from daemon: volume k3d-k3s-default-images is being used by the following container(s): 5fc21a07d4189a0a93dd3a65142f1f5889e1788ca0076347e4d80aed05e9dd9d, 714544cc5de7ae3ae273f6c3c1285099d8509e4a8c3fe27d7c0ac59ff38537de: volume is being used -> Try to delete it manually 
    WARN[0016] Failed to delete volume 'k3d-testing-images' of cluster 'testing': failed to find volume 'k3d-testing-images': Error: No such volume: k3d-testing-images -> Try to delete it manually 
    FATA[0016] Cluster creation FAILED, all changes have been rolled back! 

Implications

N/A

@gonzalesraul
Copy link
Contributor Author

@all-contributors please add @gonzalesraul for code and doc

@allcontributors
Copy link
Contributor

@gonzalesraul

I've put up a pull request to add @gonzalesraul! 🎉

Copy link
Member

@iwilltry42 iwilltry42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

docs/usage/advanced/podman.md Outdated Show resolved Hide resolved
@iwilltry42 iwilltry42 self-assigned this Jun 15, 2022
@iwilltry42 iwilltry42 added the enhancement New feature or request label Jun 15, 2022
@iwilltry42 iwilltry42 added this to the v5.5.0 milestone Jun 15, 2022
@iwilltry42
Copy link
Member

Hi @gonzalesraul , thanks a lot for this, this is great! 👍

@iwilltry42 iwilltry42 merged commit b15940b into k3d-io:main Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants