Use this repository as a starting point to manage a Service Mesh on an OpenShift cluster.
-
Go to
Use this template > create a new repository
to generate a copy of this repository that you will use to manage your OpenShift cluster.The next instructions will ask you to make changes to your
cluster-gitops
repository. You can do this simply by editing directly in GitHub by just pressing.
on your keyboard to open in a browser-based editor. Or you can clone your repo to your local machine and make changes locally. -
Configure the example ArgoCD
Application
by providing your new repository URLspec.source.repoURL
in the following files:apps/application-argo-rollouts.yaml apps/application-service-mesh-operators.yaml apps/application-service-mesh-qa.yaml apps/application-service-mesh-test.yaml bootstrap/instance/application.yaml
-
Provision the ArgoCD operator:
oc apply -k bootstrap/operator
-
Provision the ArgoCD
Application
:oc apply -k bootstrap/instance
- The demo bootstrap initiates a default ArgoCD instance hosted in the
openshift-gitops
namespace. In this namespace aRoute
is deployed which provides a URL to the ArgoCD console.
The following instructions will describe how to manage applications deployed to the Service Mesh with this GitOps framework.
-
Make a fork of this sample application repo you will use the fork's URL later in the instructions.
-
Switch back to editing your
cluster-gitops
repo. -
Request new namespaces for a
test
andqa
instance of the sample applicationFor the
test
instance, editservicemesh/instance/overlays/test/namespaces.yaml
and uncomment all linesFor the
qa
instance, editservicemesh/instance/overlays/qa/namespaces.yaml
and uncomment all lines -
Add the new namespaces to the ServiceMeshMemberRoll
For the
test
instance, editservicemesh/instance/overlays/test/servicemeshmemberroll.yaml
and uncomment all linesFor the
qa
instance, editservicemesh/instance/overlays/qa/servicemeshmemberroll.yaml
and uncomment all lines -
Configure ArgoCD Applications for the bookinfo example
In the file
apps/application-bookinfo-test.yaml
application replacespec.source.repoURL
with the URL to your application source fork created in step #1.Also, in the file
apps/application-bookinfo-qa.yaml
application replacespec.source.repoURL
with the URL to your application source fork created in step #1. -
Uncomment the lines in
apps/kustomization.yaml
to deploy those apps to include thetest
andqa
applications you configured in the previous step. -
Publish your changes to your fork in your favorite way. If you're editing locally, for example, you can commit and push like this:
git add . git commit -m "onboard the bookinfo app" git push origin main
-
Use Kiali to visualize bookinfo traffic:
KIALI_URL=$(oc get route kiali -n istio-system-test -o jsonpath='{.spec.host}')
Or using openshift console: Networking->Routes->kiali
Open the URL on a browser and then click on the
bookinfo-test
app: -
Call the
productinfo
page: export the ingress gateway URL into an env variable, use curl to invoke it:BOOK_GW=$(oc get route istio-ingressgateway -n istio-system-test -o jsonpath="{.spec.host}{.spec.path}")
curl -v $BOOK_GW/productpage | grep '<title>Simple Bookstore App</title>'
-
Setup Kiali for traffic visualization by going to the left menu
Graph
then click on the drop downDisplay
and selectRequest Rate
,Request Distribution
,Namespace Boxes
,Traffic Animation
options: -
Use a simple script below to call the
productpage
every 10s:while true; \ do curl -v $BOOK_GW/productpage | grep '<title>Simple Bookstore App</title>'; \ sleep 10;done
Enter Control-C to stop the script.
-
Switch to the graph and watch the animation, observe the statistics chosen in the graph selection:
-
Select the reviews service by clicking on the node and observe on the right the incoming traffic:
-
If you want to inspect traffic metrics even further, go to the left menu named
Services
and select thereviews
service, then click on theInbound Metrics
tab: -
In the same Kiali service view you have the ability to see more in detail metrics by jumping to Grafana, click on the blue link that reads
View in Grafana
and expect something like this:
-
The next instructions will ask you to make changes to your
gitops-app-bookinfo
repository fork. You can do this simply by editing directly in GitHub by just pressing.
on your keyboard to open in a browser-based editor. Or you can clone your fork to your local machine and make changes locally. -
Edit the image version for the
productpage
deployment.In the file
envs/test/version-productpage-v1.yaml
update the image version:2.1.0
->:2.2.0
Note: You can imagine that this change might be performed by pipeline automation
-
Publish your changes to your fork in your favorite way. If you're editing locally, for example, you can commit and push like this:
git add . git commit -m "bump productpage version" git push origin main
Note: In a fully operational GitOps environment, you might have a post-commit hook on the
gitops-app-bookinfo
repository to notify ArgoCD to refresh automatically. In a demo scenario, you may just want to manually trigger a refresh of thebookinfo
application in the ArgoCD UI. This will cause ArgoCD to notice the change and begin the rollout. -
Observe the rollout which increases traffic to the new application instance 20% at a time, with a 10 second pause between each step. There are many ways to observe rollouts:
- observe the progress of the rollouts controller pod in the
argo-rollouts
namespace - use the Argo Rollouts
kubectl
plugin - view the rollout progressing in the ArgoCD UI
- use Kiali and techniques described in the validation section above, especially while running the curl loop!
- observe the progress of the rollouts controller pod in the