Kubernetes, DevOps, Cloud Computing, Software Development, Programming.
Service metadata: name: nginx-service spec: selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80 Save this as nginx-service.yaml and apply it: kubectl apply -f nginx-service.yaml Step 3: Applying Network Policies Let’s create a network policy that restricts traffic to the Nginx pods.