K8s Lab 把当前仓库文档整理成一个可阅读的网页站点

Repository Reading Site

10-web.yaml

manifests/17-acme/10-web.yaml

Text Assetmanifests/17-acme/10-web.yaml1.3 KB2026年4月10日 08:45查看原始内容
apiVersion: apps/v1
kind: Deployment
metadata:
  name: acme-web
  namespace: acme-lab
  labels:
    app: acme-web
    lesson: acme
spec:
  replicas: 1
  selector:
    matchLabels:
      app: acme-web
      lesson: acme
  template:
    metadata:
      labels:
        app: acme-web
        lesson: acme
    spec:
      containers:
        - name: main
          image: busybox:1.36
          imagePullPolicy: IfNotPresent
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: APP_HOST
              value: 154-9-27-60.sslip.io
          command:
            - /bin/sh
            - -c
          args:
            - |
              set -eu
              mkdir -p /www
              cat > /www/index.html <<EOF
              <html>
              <body>
              <h1>ACME HTTP-01 demo</h1>
              <p>pod: $(hostname)</p>
              <p>pod_ip: $(hostname -i)</p>
              <p>node: ${NODE_NAME}</p>
              <p>host: ${APP_HOST}</p>
              <p>issuer: letsencrypt-staging-http01</p>
              </body>
              </html>
              EOF
              exec httpd -f -p 8080 -h /www
          ports:
            - containerPort: 8080
              name: http