$ kubectl run web --image=gcr.io/google-samples/hello-app:1.0 --port=8080
$ kubectl expose deployment web --target-port=8080 --type=NodePort
$ helm install stable/nginx-ingress --name nginx-ingress --namespace kube-system --set rbac.create=true
$ cat <<'EOF' | kubectl create -f -
apiVersion: extensions/v1beta1kind: Ingressmetadata: annotations: kubernetes.io/ingress.class: nginx name: basic-ingress
namespace: defaultspec: backend: serviceName: web servicePort: 8080EOF
$ cat <<'EOF' | kubectl create -f -
apiVersion: extensions/v1beta1
kind: NetworkPolicy
metadata:
name: web-np
namespace: default
spec:
policyTypes:
- Ingress
podSelector: {}
ingress:
- from:
- namespaceSelector:
matchLabels:
name: kube-system
ports: - protocol: TCP port: 8080EOF
$ curl x.y.z:80
<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.13.5</center>
</body>
</html>
podSelector: {}
ingress:
- {}
$ curl x.y.z:80
Hello, world!
Version: 1.0.0
Hostname: web-6498765b79-b6866
- from:
- namespaceSelector:
matchLabels:
name: kube-system
kind: Namespace
metadata:
name: kube-system
kind: Namespace
metadata:
name: kube-system
labels:
name: kube-system
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.