Solve the problem that docker installation is completed and reported: bridge-nf-call-iptables is disabled

Solve the problem that docker installation is completed and reported: bridge-nf-call-iptables is disabled

After the docker installation is completed on the centos machine, enter the docker info command and the following warning information will be reported:

1) The warning message is as follows:

WARNING: bridge-nf-call-iptables is disabled

WARNING: bridge-nf-call-ip6tables is disabled

2) Solution:

Modify the system file to enable the machine bridge mode

Set the machine to execute the following two commands when it starts

Edit vim /etc/rc.d/rc.local and add the following two commands

echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables

echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables

CentOS 7 needs to increase execution permissions:

chmod +x /etc/rc,d/rc.local

3) Restart the system

Additional knowledge: Several ways to restart Kubernetes Pod

Preface

When using docker, we can use docker restart {container_id} to restart the container, but there is no restart command in kubernetes (no kubectl restart {podname}). Sometimes our Pod terminates unexpectedly due to a bug, causing us to need to restart the Pod, but there is no good way, especially without a yaml file, so I have summarized the following ways to restart the Pod.

Method 1

There are latest yaml files.

If there is a yaml file, you can directly use kubectl replace --force -f xxxx.yaml to force the replacement of the Pod's API object to achieve the purpose of restart. as follows:

[root@test-129-70 viua]# kubectl replace --force -f viua.yml
namespace "viua" deleted
service "viua-app-cms" deleted
deployment.apps "viua-app-cms" deleted
service "viua-app-command" deleted
deployment.apps "viua-app-command" deleted
service "viua-show-service" deleted
deployment.apps "viua-show-service" deleted
service "viua-skills-service" deleted
deployment.apps "viua-skills-service" deleted
namespace/viua replaced
secret/xa-harbor-ca replaced
service/viua-app-cms replaced
deployment.apps/viua-app-cms replaced
service/viua-app-command replaced
deployment.apps/viua-app-command replaced
service/viua-show-service replaced
deployment.apps/viua-show-service replaced
service/viua-skills-service replaced
deployment.apps/viua-skills-service replaced

Method 2

There is no yaml file, but a Deployment object is used.

kubectl scale deploy viua-app-cms --replicas=0 -n viua

kubectl scale deploy {deploy object} --replicas=0 -n {namespace}

[root@test-129-70 pvd]# kubectl get deploy -n viua
NAME READY UP-TO-DATE AVAILABLE AGE
viua-app-cms 1/1 1 1 48m
viua-app-command 1/1 1 1 48m
viua-show-service 1/1 1 1 48m
viua-skills-service 1/1 1 1 48m
[root@test-129-70 pvd]# kubectl scale deploy viua-app-cms --replicas=0 -n viua
deployment.apps/viua-app-cms scaled
[root@test-129-70 pvd]# kubectl get deploy -n viua
NAME READY UP-TO-DATE AVAILABLE AGE
viua-app-cms 0/0 0 0 49m
viua-app-command 1/1 1 1 49m
viua-show-service 1/1 1 1 49m
viua-skills-service 1/1 1 1 49m
[root@test-129-70 pvd]# kubectl get po -n viua
NAME READY STATUS RESTARTS AGE
viua-app-command-95f7b6f7f-rb7mh 1/1 Running 0 49m
viua-show-service-85565b9dcf-ss8qp 1/1 Running 0 49m
viua-skills-service-65447f9b94-fhqhr 1/1 Running 0 49m

Because the Deployment object does not directly control the Pod object, but the ReplicaSet object, and the ReplicaSet object is composed of the definition of the number of replicas and the Pod template. So this command scales the number of ReplicaSets to 0, and then scales it back to 1, and then the Pod is restarted.

Method 3

There is also no yaml file, but a Deployment object is used.

Use the command kubectl delete pod {podname} -n {namespace}

This method is very simple and crude. Just delete the Pod. Because Kubernetes is a declarative API, after deletion, the Pod API object will be inconsistent with the expected one, so the Pod will be automatically recreated to keep it consistent with the expected one. However, if there are many Pod objects managed by ReplicaSet, it will be troublesome to delete them one by one manually. Therefore, you can use the kubectl delete replicaset {rs_name} -n {namespace} command to delete ReplicaSet.

Method 4

There is no yaml file, the Pod object is used directly.

Use the command kubectl get pod {podname} -n {namespace} -o yaml | kubectl replace --force -f -

In this case, since there is no YAML file and the Pod object is started, it cannot be deleted or scaled to 0 directly, but it can be restarted using the above command. This command means get the YAML declaration of the currently running pod and redirect the output to the standard input of the kubectl replace command to achieve the purpose of restarting.

Summarize

We can restart objects in many ways. In general, the most recommended way is to use kubectl get pod {podname} -n {namespace} -o yaml | kubectl replace --force -f - because it is applicable to many objects. In addition, restarting the Pod will not fix the bug in the running program. If you want to solve the unexpected termination of the program, you still have to fix the bug in the end.

The above article on solving the problem of docker installation completion reporting: bridge-nf-call-iptables is disabled is all the content that the editor shared with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of installing redis in docker and starting it as a configuration file
  • Docker installation rocketMQ tutorial (most detailed)
  • Detailed explanation of how to deploy and install the Chinese version of Redash in Docker
  • Detailed steps to install docker in 5 minutes

<<:  Beginners learn some HTML tags (2)

>>:  How does MySQL achieve master-slave synchronization?

Recommend

Vue implements verification code countdown button

This article example shares the specific code of ...

How to move a red rectangle with the mouse in Linux character terminal

Everything is a file! UNIX has already said it. E...

Vue implements pull-down to load more

Developers familiar with Element-UI may have had ...

Installation and deployment of MySQL Router

Table of contents 01 Introduction to MySQL Router...

Deep understanding of the mechanism of CSS background-blend-mode

This article is welcome to be shared and aggregat...

iframe src assignment problem (server side)

I encountered this problem today. I reassigned the...

How to extend Vue Router links in Vue 3

Preface The <router-link> tag is a great to...

Native js implementation of slider interval component

This article example shares the specific code of ...

Detailed explanation of custom swiper component in JavaScript

Table of contents Effect display Component Settin...

Install mysql offline using rpm under centos 6.4

Use the rpm installation package to install mysql...

Make a nice flip login and registration interface based on html+css

Make a nice flip login and registration interface...

MYSQL Operator Summary

Table of contents 1. Arithmetic operators 2. Comp...

MySQL configuration master-slave server (one master and multiple slaves)

Table of contents Ideas Host Configuration Modify...

How to implement rounded corners with CSS3 using JS

I found an example when I was looking for a way t...

Detailed explanation of JavaScript function introduction

Table of contents Function Introduction function ...