(二十七)、k8s 部署前端项目

文章目录

1、页面展示

效果演示

1.1、卡片展示

1.2、时间效果

1.3、反转效果

2、deployment.yaml

复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: xxx-frontend
  namespace: xxx
  labels:
    app: xxx-frontend
    version: v1
spec:
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  selector:
    matchLabels:
      app: xxx-frontend
  template:
    metadata:
      labels:
        app: xxx-frontend
        version: v1
    spec:
      imagePullSecrets:
      - name: registry-secret
      containers:
      - name: frontend
        image: xxx/frontend:${IMAGE_TAG}
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
          name: http
        volumeMounts:
        - name: nginx-config
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
        resources:
          requests:
            memory: "128Mi"
            cpu: "100m"
          limits:
            memory: "256Mi"
            cpu: "200m"
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        livenessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 10
          periodSeconds: 30
          timeoutSeconds: 5
          failureThreshold: 3
      volumes:
      - name: nginx-config
        configMap:
          name: nginx-config
      restartPolicy: Always

3、执行 yaml 文件

kubectl apply -f deployment.yaml

4、效果演示

效果演示

相关推荐
OsDepK1 天前
Windows快速部署Docker
运维·docker·容器
不简说1 天前
JS 代码技巧 vol.1 — 10 个让代码少写 30% 的小套路
前端·javascript·面试
Hilaku1 天前
为什么业务型前端容易遭遇中年危机?
前端·javascript·程序员
এ慕ོ冬℘゜1 天前
深度解析 JavaScript:赋予 Web 灵魂的“全栈语言”
开发语言·前端·javascript
iCOD3R1 天前
Skill - 3秒生成精美GitHub主页
前端·程序员·ai编程
爱勇宝1 天前
《道德经》第5章:生产环境不相信眼泪
前端·后端·架构
掘金者阿豪1 天前
LEFT JOIN 凭空消失的背后,是优化器偷偷帮你做了决定
前端·后端
HackTwoHub1 天前
AntiDebug Mcp、AI逆向绕过前端,Hook 加密接口,抓取 Vue 路由漏洞,接入 MCP 让 AI 自动化挖掘前端漏洞
前端·vue.js·人工智能·安全·web安全·网络安全·系统安全
Mr_凌宇1 天前
AI 应用工程进阶扩展学习笔记 二
前端·面试
Hyyy1 天前
Git Worktree 完全讲解
前端·后端·面试