b58c8ba922
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com> |
||
---|---|---|
.vscode | ||
istio-manifests | ||
kubernetes-manifests | ||
pb | ||
src | ||
tests/cartservice | ||
.gitignore | ||
README.md | ||
skaffold.yaml |
Microservices demo
This project contains a 10-tier microservices application. The application is a web-based e-commerce app called “Hipster Shop” where users can browse items, add them to the cart, and purchase them.
Running locally
-
Install:
- kubectl (can be installed via
gcloud components install kubectl
) - Docker for Desktop (Mac/Windows): Download the Edge release; not the stable. Edge release provides Kubernetes support as noted here.
- skaffold
- kubectl (can be installed via
-
Launch Docker for Desktop. Go to Preferences and choose “Enable Kubernetes”.
-
Run
kubectl get nodes
to verify you're connected to Kubernetes on Docker. -
Run
skaffold run
(first time will be slow). This will build and deploy the application. If you need to rebuild the images automatically as you refactor the code, runskaffold dev
command. -
Run
kubectl get pods
to verify the Pods are ready and running. The application frontend should be available at http://localhost:80 on your machine.
Setup on GKE
-
Install tools specified in the previous section (Docker, kubectl, skaffold)
-
Create a Google Kubernetes Engine cluster and make sure
kubectl
is pointing to the cluster. -
Enable Google Container Registry (GCR) on your GCP project:
gcloud services enable containerregistry.googleapis.com
-
Configure docker to authenticate to GCR:
gcloud auth configure-docker -q
-
Edit
skaffold.yaml
, prepend your GCR registry host (gcr.io/YOUR_PROJECT/
) to allimageName:
fields (or update the existing project name). -
Edit the Deployment manifests at
kubernetes-manifests
directory and update theimage
fields to match the changes you made in the previous step. -
Run
skaffold run
. This builds the container images, pushes them to GCR, and deploys the application to Kubernetes. -
Find the IP address of your application:
kubectl get service frontend-external
then visit the application on your browser to confirm installation.
Istio Deployment
-
Create a GKE cluster.
-
Install Istio without mutual TLS enablement.
-
Install the automatic sidecar injection (annotate the
default
namespace with the label):kubectl label namespace default istio-injection=enabled
-
Deploy the application.
-
Apply the manifests in
./istio-manifests
directory.kubectl apply -f ./istio-manifests