↓ Skip to main content
Kubernetes

Network Policy Restrictions

·1 min
kubectl run --namespace=np-demo nginx --replicas=2 --image=nginx
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: default-deny
  namespace: np-demo
spec:
  podSelector:
    matchLabels: {}
k expose --namespace=np-demo deployment nginx --port=80
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: access-nginx
  namespace: np-demo
spec:
  podSelector:
    matchLabels:
      run: nginx
  ingress:
    - from:
      - podSelector:
          matchLabels:
            run: allowed
k run --namespace=np-demo no-access --rm -ti --image busybox /bin/sh
wget -q --timeout=5 nginx -O -
 k run --namespace=policy-demo allowed --rm -ti --image busybox /bin/sh
Author
Samarthya
Engineer, learner, tinkerer. This is my trophy shelf of everyday work and leisure.

Related

Helm Charts: Packaging

·2 mins
Every software cycle includes packaging; which essentially describes how the software written is packaged and shared. For the software built for Containers Helm is a popular choice of packaging the scripts.

PlayGround: K8S

·6 mins
I have been working on Kubernetes cluster and will soon plan to give a Kubernetes Certified Developer exam. In my quest, I will just record some commands that I found helpful or useful in this blog. It may be multi-part, as I will keep adding on a daily basis the commands that I will be learning.