Let's use the Snyk CLI to validate our Kubernetes files meet our security policies from the developer's environment. Assuming we are in the root folder of the SPC application, execute this command. The output will show any security issues Snyk has discovered and suggestions on how to fix the Kubernetes files.
snyk iac test kubernetes/petclinic-deployment.yaml
This scan will be immediate.
After a quick validation check of our Kubernetes files, let's complete our developer experience. We will deploy a Helm based MySQL instance and the SPC application. After the deployment is complete, we will send a simple request to validate our deployment.
The lab VM is configured with a Kubernetes cluster to deploy the SPC application. We have created alias commands for Kubectl (k) and Helm (h) to save your fingers from typing. We are also using a namespace called demo.
k create namespace demo
h install petclinic-db --set mysqlDatabase=petclinic stable/mysql --namespace demo
k -n demo apply -f kubernetes/petclinic-deployment.yaml
k -n demo apply -f kubernetes/petclinic-svc-nodeport.yaml
Validate the deployment using the SPC button at the top of your lab view.
Assuming all configuration is correct, the SPC button will show the SPC home page.