This is a simple demo application demonstrating a Java application's journey from development to production.
It comprises of a Spring Boot application that exposes a single API endpoint that returns a greeting as a string. Cliche. Right? That needs to find its way to Kubernetes. Not so cliche for a Greetings app. Huh?
$ ./gradlew build
Build and skip tests...
$ ./gradlew build -x test
Test application....
$ curl localhost:8080
$ ./gradlew jibDockerBuild
List docker images....
$ docker images
Running a container from the docker image....
$ docker run --name greetings-app -p 8080:8080 -d greetings:1.0.0-RELEASE
or with an environment variable
$ docker run --name greetings-app -p 8080:8080 --env GREETINGS_SALUTATION=Niaje! -d greetings:1.0.0-RELEASE
Test application....
$ curl localhost:8080
Minikube hack to build image to kubernetes
$ eval $(minikube docker-env)
$ ./gradlew jibDockerBuild
Deploy app to kubernetes on developer machine
$ kubectl apply -f manifest/vanilla/greetings-application-v1.yaml
$ kubectl get deployments -n ns-workshop
NAME READY UP-TO-DATE AVAILABLE AGE
greetings 1/1 1 1 2m26s
$ kubectl get pods -n ns-workshop
NAME READY STATUS RESTARTS AGE
greetings-6b7c4bbf77-jnbvx 1/1 Running 0 2m36s
$ kubectl get services -n ns-workshop
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
greetings-app NodePort 10.104.188.88 8080:30245/TCP 19s
$ minikube service -n ns-workshop greetings-app
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
-
gke_my-lab-... gke_my-lab-... gke_my-lab-... minikube.istio minikube.istio minikube.istio
$ kubectl config use-context <context-name>
$ helm install ./manifest/helm-charts/greetings --debug --dry-run
$ helm install ./manifest/helm-charts/greetings
NAME: yellow-ferret LAST DEPLOYED: Wed Jul 24 23:04:14 2019 NAMESPACE: default STATUS: DEPLOYED
RESOURCES: ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE yellow-ferret-greetings ClusterIP 10.36.12.175 8080/TCP 1s
==> v1/Deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE yellow-ferret-greetings 1 1 1 0 1s
==> v1/Pod(related) NAME READY STATUS RESTARTS AGE yellow-ferret-greetings-547b4d5bd9-ns828 0/1 ContainerCreating 0 1s
$ helm delete yellow-ferret
Out of the box features:
- Request routing
- Fault injection
- Traffic shifting
- Querying metrics
- Visualizing metrics
- Collecting logs
- Rate limiting
- Ingress gateways
- Accessing external services
- Visualizing your mesh
Open Prometheus dashboard
$ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') 9090:9090 &
Go to http://localhost:9090
Execute a Prometheus query.
In the “Expression” input box at the top of the web page, enter the text: istio_requests_total. Then, click the Execute button
Total count of all requests to greetings-app service
$ istio_requests_total{destination_service="greetings-app.ns-workshop.svc.cluster.local"}
Total count of all requests to version 4 of greetings-app service
$ istio_requests_total{destination_service="greetings-app.ns-workshop.svc.cluster.local", destination_version="v3"}
Open Grafana dashboard
$ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 &
Go to http://localhost:3000/dashboard/db/istio-mesh-dashboard
Go to http://localhost:3000/dashboard/db/istio-service-dashboard
Go to http://localhost:3000/dashboard/db/istio-workload-dashboard
Out of the box features:
- HTTP, HTTP/2, and gRPC Proxying
- TCP Proxying and Protocol Detection
- Retries and Timeouts
- Automatic mTLS
- Automatic Proxy Injection
- Service Profiles
- Ingress
- Telemetry and Monitoring
- Load Balancing
- Dashboard and Grafana
$ linkerd dashboard
This command retrieves all of the deployments running in the nairobijvm namespace, runs the set of Kubernetes resources through inject, and finally reapplies it to the cluster.
$ kubectl get -n ns-workshop deploy -o yaml \
| linkerd inject - \
| kubectl apply -f -
$ minikube service -n ns-workshop greetings-app
$ while true; do curl http://192.168.39.9:31081/; done
To clean up the resources you created in your cluster:
$ kubectl delete service greetings-app -n ns-workshop
$ kubectl delete deployment greetings -n ns-workshop
$ ./gradlew jib
Pull and use registry:v2 to quickly setup a local docker image registry.