Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to customize Calico Network Policy

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to customize Calico network Policy, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

The default policy rule for Calico is that containers can only communicate with containers in the same calico network.

Calico allows users to define flexible policy rules to finely control the traffic in and out of the container. Let's practice a scenario:

Create a new calico network cal_web and deploy a httpd container web1.

Defines that policy allows containers in cal_net2 to access port 80 of web1.

First create the cal_web.

Docker network create-- driver calico--ipam-driver calico-ipam cal_web

Run the container web1 in host1 and connect to cal_web:

Docker container run-net cal_web-name web1-d httpd

The IP of web1 is 192.168.119.7.

Bbox3 is currently unable to access port 80 of web1.

Create the policy file web.yml with the following contents:

① profile has the same name as the cal_web network, and all containers (web1) of cal_web apply the policy in this profile.

② ingress allows access to containers (bbox3) in cal_net2.

③ only opens port 80.

Apply the policy.

Calicoctl apply-f web.yml

Bbox3 is now able to access web1's http service.

However, ping still does not work, because only port 80 has been released.

The above example is relatively simple, but it has shown us the powerful policy capabilities of calico. Through policy, very complex container access control can be implemented dynamically.

The above is how to customize the Calico network Policy, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report