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

Basic usage tutorial of MySQL slow query log

Slow query log related parameters MySQL slow quer...

JS, CSS and HTML to implement the registration page

A registration page template implemented with HTM...

How to modify the contents of an existing Docker container

1. Docker ps lists containers 2. Docker cp copies...

Summary of XHTML application in web design study

<br />Generally speaking, the file organizat...

Detailed explanation of the Sidecar mode in Docker Compose

Table of contents What is Docker Compose Requirem...

Summary of basic operations for MySQL beginners

Library Operations Query 1.SHOW DATABASE; ----Que...

CSS3 border effects

What is CSS# CSS (abbreviation of Cascading Style...

JavaScript common statements loop, judgment, string to number

Table of contents 1. switch 2. While Loop 3. Do/W...

Solutions to invalid is Null segment judgment and IFNULL() failure in MySql

MySql Null field judgment and IFNULL failure proc...

Encoding problems and solutions when mysql associates two tables

When Mysql associates two tables, an error messag...