-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HELP] Network policy not working [Services and Networking] #224
Comments
I am having this same problem as well, where both commands are returning responses. Not sure if it's relevant but I am using minikube, so maybe the prerequisites aren't being met? Network Policy: apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
creationTimestamp: "2021-08-31T20:58:43Z"
generation: 1
name: access-nginx
namespace: default
resourceVersion: "25089"
uid: 37b0087e-4d65-4ad2-8b39-27c391068173
spec:
ingress:
- from:
- podSelector:
matchLabels:
access: granted
podSelector:
matchLabels:
app: nginx
policyTypes:
- Ingress
service: apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2021-08-31T20:51:48Z"
labels:
app: nginx
name: nginx
namespace: default
resourceVersion: "24761"
uid: 88635026-b066-4891-8247-d6a2d59beaf2
spec:
clusterIP: 10.96.54.89
clusterIPs:
- 10.96.54.89
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {} deployment: apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2021-08-31T20:51:39Z"
generation: 1
labels:
app: nginx
name: nginx
namespace: default
resourceVersion: "24755"
uid: 051428ca-3964-4872-9e17-fc2559e72dd7
spec:
progressDeadlineSeconds: 600
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 2
conditions:
- lastTransitionTime: "2021-08-31T20:51:41Z"
lastUpdateTime: "2021-08-31T20:51:41Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2021-08-31T20:51:39Z"
lastUpdateTime: "2021-08-31T20:51:41Z"
message: ReplicaSet "nginx-6799fc88d8" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 1
readyReplicas: 2
replicas: 2
updatedReplicas: 2 output of
output of
output of
|
I followed https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/ and was able to get it to work properly. @pkb2 is your cluster set up to allow network policies? |
I will check. |
I am having the same issue. Using docker-desktop for k8s. |
start minikube with cni flag otherwise network policy will not work
|
hey, linky linky: if you are using flannel for example, at the time of writing the policy will be applied successfully, but wont be enforced. |
In the last question of "Services and Networking":
Network policy seems not working. I am able to get responses for both the busybox commands:
Network policy created
Can you identify what is missing here. TIA
The text was updated successfully, but these errors were encountered: