(二十七)、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、效果演示

效果演示

相关推荐
不务正业的前端学徒9 分钟前
手写简单的call bind apply
前端
jump_jump12 分钟前
Ripple:一个现代的响应式 UI 框架
前端·javascript·前端框架
用户9047066835720 分钟前
Nuxt css 如何写?
前端
夏天想21 分钟前
element-plus的输入数字组件el-input-number 显示了 加减按钮(+ -) 和 小三角箭头(上下箭头),怎么去掉+,-或者箭头
前端·javascript·vue.js
0思必得022 分钟前
[Web自动化] Selenium基础介绍
前端·python·selenium·自动化·web自动化
Filotimo_24 分钟前
前端.d.ts文件作用
前端
进击的野人25 分钟前
Vue 3 响应式数据解构:toRef 与 toRefs 的深度解析
前端·vue.js·前端框架
ohyeah26 分钟前
CSS 作用域隔离实战:React、Vue 与 Styled Components 的三种范式
前端
二哈喇子!42 分钟前
前端HTML、CSS、JS、VUE 汇总
开发语言·前端
小白路过42 分钟前
node-sass和sass兼容性使用
前端·rust·sass