2.1.5 Deploy GHCR Image to Tanzu Unmanaged Cluster using Kubernetes
This tutorial will demonstrate how to deploy the image of the Spring Boot Application that we pushed to GHCR to the unmanaged cluster we created with Tanzu Community Edition using Kubernetes.
Pre-Requisites
Installations
Note: Run the following command(s) in Terminal/Command line to verify Installations
kubectl version
Deploy To Unmanaged Cluster using Kubernetes using your Image
- Open your IDE to your Spring Boot Application
- Open
kubernetes.yaml
- Set
spec.containers:image:
to the link to your image like below... spec: containers: - image: ghcr.io/<github-username>/resume-image:latest ... ...
- Save this change using
CNTRL
+S
orFile > Save
- Open Terminal (cd into the directory containing your repository)
- Run the following commands
-
See that your unmanaged cluster has been created as a Kubernetes in Docker or KinD cluster
(Note: The name of your Kubernetes Context with be kind-clusterName)
kubectl config get-contexts
-
Set the Kubernetes context to your unmanaged cluster
kubectl config use-context kind-resume-cluster
- Create a Kubernetes Pod based on your Spring Boot App Image
kubectl create -f kubernetes.yaml
- See that your Kubernetes Pod has been created
kubectl get pods
- Connect your Kubernetes Pod port (8080) to your local host port (8080)
kubectl port-forward resume-app-pod 8080:8080
-
- Open http://localhost:8080 in your browser!
Note: To stop this from running press CNTRL
+ C