Skip to content

Conversation

@alpeb
Copy link
Member

@alpeb alpeb commented Aug 6, 2020

Followup to #4

iptables-save doesn't accept the -w argument, which is causing the script to error, when used in CNI.

This is from containerd.log:

Aug 06 19:10:05 kind-control-plane containerd[143]: ------------------------------------------------------------                                                                                                                                                                                                               
Aug 06 19:10:05 kind-control-plane containerd[143]: 2020/08/06 19:10:05 Setting UseWaitFlag: iptables will wait for xtables to become available                                                                                                                                                                                
Aug 06 19:10:05 kind-control-plane containerd[143]: 2020/08/06 19:10:05 :; nsenter --net=/var/run/netns/cni-a3b64280-7324-5020-e69b-f2dc889fe290 iptables-save -w                                         
Aug 06 19:10:05 kind-control-plane containerd[143]: 2020/08/06 19:10:05 ERROR: No valid subcommand given.                                                      
Aug 06 19:10:05 kind-control-plane containerd[143]: Valid subcommands:                                                                                                                                                                                                                                                         
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables                                                                                                                                                                                                                                                                
Aug 06 19:10:05 kind-control-plane containerd[143]:  * main4                                                                                                                                                                                                                                                                   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-save   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * save4                                                                                                   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-restore                                                                                                                                                                                                                                                        
Aug 06 19:10:05 kind-control-plane containerd[143]:  * restore4                                                                                                                                                                                                                                                                
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-legacy                                                                                         
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-legacy-save                                                                                    
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-legacy-restore                                                                                 
Aug 06 19:10:05 kind-control-plane containerd[143]:  * iptables-xml                                                                                            
Aug 06 19:10:05 kind-control-plane containerd[143]:  * xml                                                                                                     
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables                                                                                               
Aug 06 19:10:05 kind-control-plane containerd[143]:  * main6                                                                                                   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables-save                                                                                          
Aug 06 19:10:05 kind-control-plane containerd[143]:  * save6                                                                                                   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables-restore                                                                                       
Aug 06 19:10:05 kind-control-plane containerd[143]:  * restore6                                                                                                
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables-legacy                                                                                        
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables-legacy-save                                                                                   
Aug 06 19:10:05 kind-control-plane containerd[143]:  * ip6tables-legacy-restore                                                                                
Aug 06 19:10:05 kind-control-plane containerd[143]: 2020/08/06 19:10:05 Aborting firewall configuration                                                        

Followup to #4

`iptables-save` doesn't accept the `-w` argument, which is causing the
script to error, when used in CNI.

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
@alpeb
Copy link
Member Author

alpeb commented Aug 6, 2020

It turns out the problem is not just iptables-save -w, but any iptables (and derivatives) command is failing with the same error. This is only happening in CNI and not from the proxy-init container, so I suspect the problem has to do when using these commands with nsenter...

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
@alpeb
Copy link
Member Author

alpeb commented Aug 6, 2020

Another problem was that nsenter wasn't properly escaping its arguments. The last push addresses that.

Copy link
Contributor

@cpretzer cpretzer left a comment

Choose a reason for hiding this comment

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

Nice fix! :shipit:

@alpeb alpeb merged commit dab022b into master Aug 6, 2020
@alpeb alpeb deleted the alpeb/fix-wait branch August 6, 2020 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants