Getting started with logging: Lokistack
This tutorial explains how to view the logs of an application on Openshift.
Requirements
To follow this guide, please make sure that you have the following tools installed:
oc
-
You can download the OpenShift command directly from OpenShift Web Console. Open the help menu (marked as a question mark at the top right) and select the "Command line tools" entry.
Step 1: Deploy Fortune application
-
Create a new namespace called
demo-fortune
oc new-project demo-fortune
If you get an error that the namespace already exists, please pick another name and try again. We recommend prefixing the name with the name of your organization to minimize potential for name collisions.
-
Create Fortune application manifest
Manifest for Fortune applicationapiVersion: apps/v1 kind: Deployment metadata: labels: app: fortune-cookie name: fortune-cookie spec: replicas: 1 selector: matchLabels: app: fortune-cookie template: metadata: labels: app: fortune-cookie spec: containers: - image: registry.gitlab.com/vshn/applications/fortune-go:latest imagePullPolicy: IfNotPresent name: fortune-cookie --- apiVersion: v1 kind: Service metadata: labels: app: fortune-cookie name: fortune-cookie spec: ports: - port: 8080 protocol: TCP targetPort: 8080 name: web selector: app: fortune-cookie type: ClusterIP
-
Deploy Fortune application manifest
oc apply -f fortune.yaml
-
Expose Fortune application
oc expose svc/fortune-cookie