Created
November 2, 2020 06:56
-
-
Save ams0/ec635767efeaed180ce46ad2389d802f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper/release-3.1/deploy/gatekeeper.yaml | |
kubectl apply -f https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/Kubernetes/load-balancer-no-public-ips/template.yaml | |
kubectl apply -f - <<EOF | |
apiVersion: constraints.gatekeeper.sh/v1beta1 | |
kind: K8sAzureLoadBalancerNoPublicIPs | |
metadata: | |
name: load-balancer-no-public-ips | |
spec: | |
match: | |
excludedNamespaces: ["kube-system","ingress","istio-system"] | |
kinds: | |
- apiGroups: [""] | |
kinds: ["Service"] | |
EOF | |
kubectl create deploy nginx --image nginx --port 80 | |
kubectl expose deploy nginx --type LoadBalancer --port 80 #fails | |
kubectl expose deploy nginx --type LoadBalancer --port 80 --overrides='{ "apiVersion": "v1" , "kind": "Service" , "metadata": { "annotations": { "service.beta.kubernetes.io/azure-load-balancer-internal": "true" } } }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment