How to allow/deny http requests from other namespaces of the same cluster?

How to allow/deny http requests from other namespaces of the same cluster?

In a cluster with 2 namespaces (ns1 and ns2), I deploy the same app (deployment) and expose it with a service.

In a cluster with 2 namespaces (ns1 and ns2), I deploy the same app (deployment) and expose it with a service.

I thought separate namespaces would prevent from executing curl http://deployment.ns1 from a pod in ns2, but apparently, it's possible.

So my question is, how to allow/deny such cross namespaces operations? For example:

  • pods in ns1 should accept requests from any namespace
  • pods (or service?) in ns2 should deny all requests from other namespaces


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

What is Kubernetes | Kubernetes Introduction | Intellipaat

🔥Intellipaat Kubernetes course: https://intellipaat.com/kubernetes-training/ In this kubernetes introduction video, you will learn what is kubernetes, it's f...

kubernetes Tutorial | What is kubernetes | Intellipaat

🔥Intellipaat Kubernetes course: https://intellipaat.com/kubernetes-training/ In this kubernetes tutorial video you will learn what is kubernetes, why Kuberne...

What is Kubernetes | Kubernetes Tutorial For Beginners

This video on "What is Kubernetes | Kubernetes Tutorial For Beginners" will give you an introduction to one of the most popular Devops tool in the market - Kubernetes, and its importance in today's IT processes. This tutorial is ideal for beginners who want to get started with Kubernetes & DevOps