kubectl get pods
kubectl describe pod <pod_name>
kubectl logs <pod_name> -c <container_name>
apiVersion
, kind
, and metadata
fields to define the Deployment.replicas
field to 1 to ensure only one instance of the script is running.spec.template.spec.containers
field.command
field to execute the Python script.apiVersion
, kind
, and metadata
fields to define the NetworkPolicy.spec.podSelector
field to select the pods running the Python script.spec.ingress
field to specify the allowed inbound traffic rules.ports
field to restrict traffic to specific ports or port ranges.from
field to restrict traffic based on source IP addresses or namespaces.kubectl
to deploy the Python script and enforce the NetworkPolicy.
kubectl apply -f <deployment_manifest_file>
to deploy the Python script.kubectl apply -f <networkpolicy_manifest_file>
to enforce the NetworkPolicy.kubectl get deployments
and kubectl get networkpolicies
.