Skip to main content
Deploy a simple nginx app using Kubernetes manifests. This verifies your cluster is working and shows the kubectl workflow.

Prerequisites

Complete Getting Started steps 1-5 to set up CLI and create a VM.

Get your workload hostname

neterial infra get workload-hostname
Save this value - you’ll need it for the Ingress configuration.

Create the manifest

Create a file named web-app.yaml with the following content, or download it here. Replace <your-workload-hostname> with your actual hostname from the previous step.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web-app
  template:
    metadata:
      labels:
        app: web-app
    spec:
      containers:
      - name: web-app
        image: nginx
        command:
          - /bin/sh
          - -c
          - "echo 'Hello from k8s!' > /usr/share/nginx/html/index.html && nginx -g 'daemon off;'"
---
apiVersion: v1
kind: Service
metadata:
  name: web-app
spec:
  selector:
    app: web-app
  ports:
  - port: 80
    targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-app
  annotations:
    kubernetes.io/ingressClassName: "traefik"
    traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
    traefik.ingress.kubernetes.io/router.tls.certresolver: default
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  rules:
    - host: "web-app.<your-workload-hostname>"
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web-app
                port:
                  number: 80

Deploy

kubectl apply -f web-app.yaml

Verify

Check the deployment is ready:
kubectl get deployment web-app
Get your app URL:
kubectl get ingress web-app -o jsonpath='{.spec.rules[0].host}'
Open https://<hostname> in your browser. You should see:
Hello from k8s!
TLS certificate is provisioned automatically (may take a minute).

Clean up

kubectl delete -f web-app.yaml