Securing your Pods using the NetworkPolicy object
The NetworkPolicy
object is the last resource kind we need to discover as part of this chapter to have an overview of services in this chapter. NetworkPolicy
will allow you to define network firewalls directly implemented in your cluster.
Why do you need NetworkPolicy?
When you have to manage a real Kubernetes workload in production, you'll have to deploy more and more applications onto it, and it is possible that these applications will have to communicate with each other.
Achieving communication between applications is really one of the fundamental objectives of a microservice architecture. Most of this communication will be done through the network, and the network is forcibly something that you want to secure by using firewalls.
Kubernetes has its own implementation of network firewalls called NetworkPolicy
. This is a new resource kind we are going to discover. Say that you want one nginx resource to be accessible...