Skip to content

Instantly share code, notes, and snippets.

@rvennam
Last active May 12, 2022 20:06
Show Gist options
  • Save rvennam/5b7856712ad8c6d12f3ccca5d3208a70 to your computer and use it in GitHub Desktop.
Save rvennam/5b7856712ad8c6d12f3ccca5d3208a70 to your computer and use it in GitHub Desktop.
kubectl config use-context $CLUSTER1
kubectl create ns gloo-mesh-test
kubectl label ns gloo-mesh-test istio-injection=enabled
cat <<EOF | oc -n gloo-mesh-test create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: istio-cni
EOF
oc adm policy add-scc-to-group anyuid system:serviceaccounts:gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/sleep/sleep.yaml -n gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml -l service=helloworld -n gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml -l version=v1 -n gloo-mesh-test
kubectl config use-context $CLUSTER2
kubectl create ns gloo-mesh-test
kubectl label ns gloo-mesh-test istio-injection=enabled
cat <<EOF | oc -n gloo-mesh-test create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: istio-cni
EOF
oc adm policy add-scc-to-group anyuid system:serviceaccounts:gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/sleep/sleep.yaml -n gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml -l service=helloworld -n gloo-mesh-test
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml -l version=v2 -n gloo-mesh-test
kubectl config use-context $CLUSTER1
kubectl exec deploy/sleep -c sleep -n gloo-mesh-test -- curl -v http://helloworld.gloo-mesh-test.svc.cluster2.global:5000/hello
kubectl config use-context $CLUSTER2
kubectl exec deploy/sleep -c sleep -n gloo-mesh-test -- curl -v http://helloworld.gloo-mesh-test.svc.cluster1.global:5000/hello
@rvennam
Copy link
Author

rvennam commented May 12, 2022

apiVersion: networking.mesh.gloo.solo.io/v1
kind: AccessPolicy
metadata:
  namespace: gloo-mesh
  name: helloworld
spec:
  sourceSelector:
  - kubeServiceAccountRefs:
      serviceAccounts:
        - name: sleep
          namespace: gloo-mesh-test
  destinationSelector:
  - kubeServiceMatcher:
      namespaces:
      - gloo-mesh-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment