Skip to content

Instantly share code, notes, and snippets.

@marco79cgn
Created March 28, 2018 22:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marco79cgn/0b15cc221cea1feb51c7d9694936183e to your computer and use it in GitHub Desktop.
Save marco79cgn/0b15cc221cea1feb51c7d9694936183e to your computer and use it in GitHub Desktop.
Makefile for Istio101 using Minikube on macOS (see https://github.com/thesandlord/Istio101)
# Copyright 2018, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHELL := /bin/bash
PROJECT_ID=$(shell gcloud config list project --format=flattened | awk 'FNR == 1 {print $$2}')
JAEGER_POD_NAME=$(shell kubectl -n istio-system get pod -l app=jaeger -o jsonpath='{.items[0].metadata.name}')
SERVICEGRAPH_POD_NAME=$(shell kubectl -n istio-system get pod -l app=servicegraph -o jsonpath='{.items[0].metadata.name}')
GRAFANA_POD_NAME=$(shell kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}')
GCLOUD_USER=$(shell gcloud config get-value core/account)
GATEWAY_IP=$(shell kubectl get po -l istio=ingress -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(shell kubectl get svc istio-ingress -n istio-system -o 'jsonpath={.spec.ports[0].nodePort}')
create-cluster:
minikube start --vm-driver=hyperkit \
--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
deploy-istio:
kubectl apply -f istio-0.6/install/kubernetes/istio.yaml
./istio-0.6/install/kubernetes/webhook-create-signed-cert.sh --service istio-sidecar-injector --namespace istio-system --secret sidecar-injector-certs
kubectl apply -f istio-0.6/install/kubernetes/istio-sidecar-injector-configmap-release.yaml
cat istio-0.6/install/kubernetes/istio-sidecar-injector.yaml | ./istio-0.6/install/kubernetes/webhook-patch-ca-bundle.sh > istio-0.6/install/kubernetes/istio-sidecar-injector-with-ca-bundle.yaml
kubectl apply -f istio-0.6/install/kubernetes/istio-sidecar-injector-with-ca-bundle.yaml
kubectl apply -f istio-0.6/install/kubernetes/addons/prometheus.yaml
kubectl apply -f istio-0.6/install/kubernetes/addons/grafana.yaml
kubectl apply -n istio-system -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml
kubectl apply -f istio-0.6/install/kubernetes/addons/servicegraph.yaml
kubectl label namespace default istio-injection=enabled
deploy-stuff:
kubectl apply -f ./configs/kube/services.yaml
kubectl apply -f ./configs/kube/deployments.yaml
get-stuff:
kubectl get pods && kubectl get svc && kubectl get ingress
egress:
istioctl create -f ./configs/istio/egress.yaml
prod:
istioctl create -f ./configs/istio/routing-1.yaml
retry:
istioctl replace -f ./configs/istio/routing-2.yaml
ingress:
kubectl delete svc frontend
kubectl create -f ./configs/kube/services-2.yaml
canary:
istioctl create -f ./configs/istio/routing-3.yaml
get-rules:
istioctl get routerules -o yaml
start-monitoring-services:
$(shell kubectl -n istio-system port-forward $(JAEGER_POD_NAME) 16686:16686 & kubectl -n istio-system port-forward $(SERVICEGRAPH_POD_NAME) 8088:8088 & kubectl -n istio-system port-forward $(GRAFANA_POD_NAME) 3000:3000)
build:
docker build -t eu.gcr.io/$(PROJECT_ID)/temp/istiotest:latest ./code/
push:
gcloud docker -- push eu.gcr.io/$(PROJECT_ID)/temp/istiotest:latest
run-local:
docker run -ti -p 3000:3000 eu.gcr.io/$(PROJECT_ID)/temp/istiotest:latest
gui:
open -a Safari http://$(GATEWAY_IP)
restart-all:
kubectl delete pods --all
delete-route-rules:
istioctl delete routerules frontend-route
istioctl delete routerules middleware-dev-route
istioctl delete routerules middleware-route
istioctl delete routerules backend-route
delete-cluster:
kubectl delete service frontend
kubectl delete ingress istio-ingress
minikube delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment