Skip to content

Instantly share code, notes, and snippets.

@rosenhouse
Forked from angelachin/setup.md
Last active February 18, 2018 23:26
Show Gist options
  • Save rosenhouse/30269d295368e8258c2b84b1de20e0a8 to your computer and use it in GitHub Desktop.
Save rosenhouse/30269d295368e8258c2b84b1de20e0a8 to your computer and use it in GitHub Desktop.
Exploring Istio on Minikube

install required tools

brew install kubectl
brew cask reinstall minikube

note the reinstall so that you get the latest version

boot local kubernetes cluster

minikube start \
  --extra-config=controller-manager.ClusterSigningCertFile="/var/lib/localkube/certs/ca.crt" \
  --extra-config=controller-manager.ClusterSigningKeyFile="/var/lib/localkube/certs/ca.key" \
  --extra-config=apiserver.Admission.PluginNames=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota \
  --kubernetes-version=v1.9.0

If an error occurs, try to minikube delete -v 0 and try again

get latest istio

(reference doc)

mkdir -p ~/workspace/istio-sandbox && cd ~/workspace/istio-sandbox
curl -L https://git.io/getLatestIstio | sh -
cd istio-0.5.1
cp bin/istioctl /usr/local/bin/

install istio onto your kubernetes

kubectl apply -f install/kubernetes/istio-auth.yaml

If it fails, re-run it (really, the second time works!)

deploy bookinfo sample

(reference doc)

kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo.yaml)
export GATEWAY_URL=$(kubectl get po -l istio=ingress -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc istio-ingress -n istio-system -o 'jsonpath={.spec.ports[0].nodePort}')

so that

echo $GATEWAY_URL

shows an IP and port and when you

curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage

you get a 200, indicating the bookinfo app is running

to see the app in your browser

open http://${GATEWAY_URL}/productpage

useful commands

to get a debug container:

  • edit samples/bookinfo/kubernetes/bookinfo.yaml and add a container to the Productpage pod:
- name: debug
  image: tutum/curl
  command: [ "/bin/sleep" ]
  args: [ "infinity" ]

get current name of a pod:

export PRODUCT_PAGE_POD=$(kubectl get po -l app=productpage -o 'jsonpath={.items[0].metadata.name}')

query pilot from that pod

kubectl exec -it $PRODUCT_PAGE_POD -c debug -- curl http://istio-pilot.istio-system:15003/v1/listeners/x/sidecar~10.0.0.1~x~x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment