Before we can create the Links 'R' Us StatefulSet, there is one more aspect that we need to take care of: the CockroachDB instance is not aware of the schema for the link graph. Nothing to worry about... We can remedy this issue by spawning a one-off container that will create the database for the link graph and apply the schema migrations from Chapter 6, Building a Persistence Layer.
You can find the source code and Dockerfile for this container in the Chapter10/cdb-schema folder. Assuming that you are currently using Minikube for your cluster, you can run the following command in the preceding folder to create the Docker image and push it to the private registry exposed by Minikube:
make dockerize-and-push
Moving back to the manifests inside the Chapter10/k8s folder, you can apply the 02-cdb-schema.yaml manifest to create a one-off Kubernetes Job that waits for the DB cluster to become available, ensures that the link-graph database and schema are up to date, and then exits. Here's what the content of this YAML file looks like:
apiVersion: batch/v1 kind: Job metadata: name: cdb-ensure-schema namespace: linksrus-data spec: template: spec: containers: - name: cdb-schema imagePullPolicy: Always image: localhost:5000/cdb-schema:latest args: - "linkgraph" - "cdb-cockroachdb-public.linksrus-data" restartPolicy: Never
Finally, we can deploy the remaining Links 'R' Us resources by applying the 03-linksrus-monolith.yaml manifest. If you haven't done so already, make sure that you run make dockerize-and-push in the Chapter10/linksrus folder prior to applying the manifest to make sure that Kubernetes can find the referenced container images.
After a few seconds, you can type kubectl -n linksrus get pods,statefulsets,services,ingresses to get a list of all the resources we just deployed. The following screenshot shows the expected output of this command:

Success! Our monolithic application has been deployed and connected to the data stores in the linksrus-data namespace. You can access the frontend service by pointing your browser to the IP address of your ingress. In the preceding output, I was using Minikube inside a VM and therefore the displayed ingress address is not accessible from the host. However, you can easily find out the public IP that was used by Minikube by running minikube ip and pointing your browser to it.
Moreover, you can also tail the logs from all the pods in the set using the kubectl -n linksrus logs -lapp=linksrus-monolith-instance -f command.