micro frontends application works on kubernetes fork by https://github.com/neuland/micro-frontends
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G84
$ docker -v
Docker version 19.03.1, build 74b1e89
use minikube for single cluster or single node
$ brew cask install minikube
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& sudo install -o root -m 4755 docker-machine-driver-hyperkit /usr/local/bin/
$ minikube start --vm-driver=hyperkit
$ eval $(minikube docker-env)
use kind for multi clusters or multi nodes
$ brew install go
$ go version
go version go1.13 darwin/amd64
$ PATH=${PATH}:$(go env GOPATH)/bin
$ kind create cluster
$ export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
$ cd team-blue && docker build -t team-blue . && cd ..
$ cd team-green && docker build -t team-green . && cd ..
$ cd team-red && docker build -t team-red . && cd ..
$ cd team-black && docker build -t team-black . && cd ..
※ The yaml files was generated using kompose
next step is for kind
$ kind load docker-image team-blue:1.0.0
$ kind load docker-image team-green:1.0.0
$ kind load docker-image team-red:1.0.0
$ kind load docker-image team-black:1.0.0
skaffold is
Easy and Repeatable Kubernetes Developmen
I use it for minikube
$ brew install skaffold
$ find . -name "mysql*.yaml" | xargs -I {} kubectl apply -f {}
$ kubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never -- mysql -h mysql-0.mysql <<EOF
CREATE DATABASE web;
EOF
$ kubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never -- mysql -h mysql-0.mysql <<EOF
CREATE TABLE web.teamGreenRelatedProducts (sku varchar(255), related_sku_id int);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_porsche', 3);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_porsche', 5);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_porsche', 6);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_fendt', 3);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_fendt', 6);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_fendt', 4);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_eicher', 1);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_eicher', 8);
INSERT INTO web.teamGreenRelatedProducts VALUES ('t_eicher', 7);
EOF
$ kubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never -- mysql -h mysql-0.mysql <<EOF
CREATE TABLE web.teamRedProducts (product_name varchar(255), sku varchar(255), color varchar(255), sku_name varchar(255), image varchar(255), thumb varchar(255), price varchar(255));
INSERT INTO web.teamRedProducts VALUES ('Tractor', 't_porsche', 'red', 'Porsche-Diesel Master 419', '/red/images/tractor-red.jpg', '/red/images/tractor-red-thumb.jpg', '66,00');
INSERT INTO web.teamRedProducts VALUES ('Tractor', 't_fendt', 'green', 'Fendt F20 Dieselroß', '/red/images/tractor-green.jpg', '/red/images/tractor-green-thumb.jpg', '54,00');
INSERT INTO web.teamRedProducts VALUES ('Tractor', 't_eicher', 'blue', 'Eicher Diesel 215/16', '/red/images/tractor-blue.jpg', '/red/images/tractor-blue-thumb.jpg', '58,00');
EOF
$ sentry_dns='https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXX@sentry.io/XXXXXX'
$ echo "sentry.dns=${sentry_dns}" > team-red-secrets && \
kubectl create secret generic team.red --from-env-file=./team-red-secrets
※ sentry
$ find . -name "*.yaml" | grep -v "skaffold.yaml" |xargs -I {} kubectl apply -f {}
$ kubectl port-forward $(k get pods | grep nginx | awk '{print $1}') 3000:3000
or
$ skaffold dev --port-forward
$ find . -name "*.yaml"|xargs -I {} kubectl delete -f {}
next step is for kind
$ kind delete cluster --name kind
$ docker images | grep "team-" | awk '{print $3}' | xargs docker rmi -f