In this lab, you will deploy a multi-tiered micro-services based e-commerce site. Several components of the application are not functioning as expected. Using the knowledge gained from previous labs, attempt to return the application to a fully functional state.
Items to note:
- There are no code changes in the application
- Inspect your Kubernetes resources, using the available tools including
kubectl describe,kubectl get,kubectl logs - Don’t forget to check the ArgoCD UI for information
To begin, create a dedicated directory for this lab and switch into it:
cd ~
mkdir online-boutique && cd online-boutique
Create namespaces for the online-boutique application:
kubectl create namespace onlineboutique-be
kubectl create namespace onlineboutique-fe
Create a Cloud Source Repository, that will be used by ArgoCD to deploy your application:
gcloud source repos create onlineboutique-deploy
Pull down the Online Boutique manifests to your local directory:
gsutil -m cp gs://student-artifacts-4rhjkg/online-boutique/* .
Initialize your Cloud Source Repository and commit the manifests to them:
git init
# Must use master otherwise ArgoCD sync fails
git checkout -b master
git add .
git commit -m "Initial Commit"
Add the remote origin for this git repository.
git remote add origin https://source.developers.google.com/p/<YOUR_PROJECT_ID>/r/onlineboutique-deploy
# only use the next command if the previous with https failed
git remote add origin ssh://<email>@source.developers.google.com:2022/p/<YOUR_PROJECT_ID>/r/onlineboutique-deploy
Create a file called frontend-ingress.yaml for your Kubernetes Ingress resource for your e-commerce site:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: onlineboutique
namespace: onlineboutique-fe
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
ingressClassName: nginx
rules:
- host: store.<YOUR_STUDENT_ID>.<RANDOM_ID>.workshops.acceleratorlabs.ca
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend
port:
number: 80
Add your Ingress object to your Git repository and push it:
git add .
git commit -m "Add Ingress"
git push origin master
Log in to ArgoCD and add a repository for this new application. Follow the same process from the Canary Deployments with Istio using ArgoCD lab.
Once you have added the repository, create and deploy an Argo Application defined in a application.yaml for your e-commerce site using the following ArgoCD Application CRD:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: onlineboutique
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
syncPolicy:
automated:
prune: true
selfHeal: true
project: default
source:
repoURL: ssh://<email>@source.developers.google.com:2022/p/<YOUR_PROJECT_ID>/r/onlineboutique-deploy
targetRevision: master
path: .
destination:
server: https://kubernetes.default.svc
namespace: onlineboutique-be
Create a .gitignore file so that we do not commit this to our repository.
cat <<EOF > .gitignore
application.yaml
EOF
Commit these changes to your repository and then use kubectl apply to apply your ArgoCD application to your cluster.
Ensure that app is online in the ArgoCD UI. Additionally, you should be able to browse the online store.
Did it work? What’s gone wrong? Spend the rest of this lab working to bring the online store into working state.
HINT - Remember:
kubectl getkubectl describekubectl logs