Deploy Apache
1. Review PHP/Apache deployment YAML
Inspect the YAML file ~/workshop/k3s/php-apache.yaml and validate the contents using the following command:
cat ~/workshop/k3s/php-apache.yamlThis file contains the configuration for the PHP/Apache deployment and will create a new StatefulSet with a single replica of the PHP/Apache image.
A stateless application does not care which network it is using, and it does not need permanent storage. Examples of stateless apps may include web servers such as Apache, Nginx, or Tomcat.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: php-apache
spec:
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
run: php-apache
serviceName: "php-apache-svc"
replicas: 1
template:
metadata:
labels:
run: php-apache
spec:
containers:
- name: php-apache
image: ghcr.io/splunk/php-apache:latest
ports:
- containerPort: 80
resources:
limits:
cpu: "8"
memory: "8Mi"
requests:
cpu: "6"
memory: "4Mi"
---
apiVersion: v1
kind: Service
metadata:
name: php-apache-svc
labels:
run: php-apache
spec:
ports:
- port: 80
selector:
run: php-apache2. Deploy PHP/Apache
Create an apache namespace then deploy the PHP/Apache application to the cluster.
Create the apache namespace:
kubectl create namespace apacheDeploy the PHP/Apache application:
kubectl apply -f ~/workshop/k3s/php-apache.yaml -n apacheEnsure the deployment has been created:
kubectl get statefulset -n apacheWorkshop Question
What metrics for your Apache instance are being reported in the Apache web servers (OTel) Navigator?
Workshop Question
Using Log Observer what is the issue with the PHP/Apache deployment?
Tip: Adjust your filters to use: k8s.namespace.name = apache and k8s.cluster.name = <your_cluster>.