首页 > 其他分享 >k8s应用一套yaml配置参考

k8s应用一套yaml配置参考

时间:2024-06-04 09:12:14浏览次数:16  
标签:cn 参考 ai 9090 yaml mcwapp mcw k8s com

从ingress详情和配置来看,有两个svc,一个svc是ingress在往后调度;另外一个是kong网关专用的,直接在空网关里配置,用nodeip:nodeport方式配置转到kong svc

 

 

1、资源

[[email protected] mcw]# kubectl get ingress --all-namespaces|grep ai-mcwapp
myprodns        ai-mcwapp-cn-ing           <none>   gatewaykong-prod-api.daqiecn.com                                                                                       80      289d
[[email protected] mcw]# 
[[email protected] mcw]# kubectl get svc --all-namespaces|grep ai-mcwapp-
myprodns                 ai-mcwapp-cn-svc                         ClusterIP      172.160.13.113   <none>        9090/TCP                                287d
myprodns                 ai-mcwapp-kong-svc                       NodePort       172.160.5.133    <none>        9090:30924/TCP                          287d
[[email protected] mcw]# kubectl get deploy --all-namespaces|grep ai-mcwapp
myprodns                 ai-mcwapp-cn-deploy                               2/2     2            2           289d

 

2、配置

[[email protected] mcw]# kubectl get ingress ai-mcwapp-cn-ing -n myprodns -o yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
  creationTimestamp: "2023-08-19T12:46:31Z"
  generation: 1
  labels:
    app: ai-mcwapp-cn
    comb: BJ
  name: ai-mcwapp-cn-ing
  namespace: myprodns
  resourceVersion: "67467990"
  uid: 527368e3-b37f-476f-9147-934326587306
spec:
  rules:
  - host: gatewaykong-prod-api.daqiecn.com
    http:
      paths:
      - backend:
          service:
            name: ai-mcwapp-cn-svc
            port:
              number: 9090
        path: /
        pathType: Prefix
status:
  loadBalancer: {}
[[email protected] mcw]# 
[[email protected] mcw]# 
[[email protected] mcw]# 
[[email protected] mcw]# kubectl get deploy ai-mcwapp-cn-deploy -n myprodns -o yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "7"
  creationTimestamp: "2023-08-19T13:12:29Z"
  generation: 8
  labels:
    app: ai-mcwapp-cn
    comb: BJ
  name: ai-mcwapp-cn-deploy
  namespace: myprodns
  resourceVersion: "156067059"
  uid: a713162e-0e50-4a82-96f1-b5eaf1e74fde
spec:
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: ai-mcwapp-cn
      comb: BJ
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: ai-mcwapp-cn
        comb: BJ
    spec:
      containers:
      - command:
        - java
        - -Xms2G
        - -Xmx2G
        - -XX:MetaspaceSize=128M
        - -XX:MaxMetaspaceSize=128M
        - -Xss256K
        - -XX:+UseConcMarkSweepGC
        - -XX:CMSFullGCsBeforeCompaction=5
        - -XX:+UseCMSCompactAtFullCollection
        - -XX:CMSInitiatingOccupancyFraction=80
        - -XX:+HeapDumpOnOutOfMemoryError
        - -XX:HeapDumpPath=./logs/
        - -DserverName=ai-mcwapp
        - -jar
        - /app.jar
        env:
        - name: SERVER_ENV
          value: ali
        - name: SPRING_PROFILES_ACTIVE
          value: ali
        - name: EGG_SERVER_ENV
          value: ali
        - name: FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION
          value: "false"
        - name: FF_USE_LEGACY_BUILDS_DIR_FOR_DOCKER
          value: "false"
        - name: FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER
          value: "false"
        - name: JAVA_PROJECT_PATH
          value: ai-mcwapp-web
        image: qa-roc.daqiecn.com/deploy_prod/common-service/ai-mcwapp-cn:v1.6.0_20240930_cn_18980438b
        imagePullPolicy: Always
        lifecycle:
          preStop:
            exec:
              command:
              - sh
              - -c
              - ps -efH|grep 'java'| grep -v 'grep'| awk '{print $2}' |xargs kill
                -15
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /argus/health
            port: 9090
            scheme: HTTP
          initialDelaySeconds: 300
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: app
        ports:
        - containerPort: 9090
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /argus/health
            port: 9090
            scheme: HTTP
          initialDelaySeconds: 300
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: "2"
            memory: 4000Mi
          requests:
            cpu: "1"
            memory: 2000Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /usr/local/share/GeoIP
          name: geoipdir
      - image: qa-roc.daqiecn.com/app-dev/flume-ali:latest
        imagePullPolicy: Always
        livenessProbe:
          exec:
            command:
            - /daqie/daqieagent/healthcheck
          failureThreshold: 3
          initialDelaySeconds: 3
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: daqieagent
        ports:
        - containerPort: 5000
          protocol: UDP
        - containerPort: 5001
          protocol: TCP
        - containerPort: 5002
          protocol: TCP
        - containerPort: 8125
          protocol: UDP
        - containerPort: 8094
          protocol: UDP
        resources:
          limits:
            cpu: 500m
            memory: 1000Mi
          requests:
            cpu: 100m
            memory: 300Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: registrykey
      initContainers:
      - image: qa-roc.daqiecn.com/library/geoip:latest
        imagePullPolicy: Always
        name: initgeoip
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /usr/local/share/GeoIP
          name: geoipdir
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: geoipdir
status:
  availableReplicas: 2
  conditions:
  - lastTransitionTime: "2023-08-21T01:44:23Z"
    lastUpdateTime: "2023-09-12T02:06:35Z"
    message: ReplicaSet "ai-mcwapp-cn-deploy-db694c657" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: "2024-05-08T07:01:44Z"
    lastUpdateTime: "2024-05-08T07:01:44Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 8
  readyReplicas: 2
  replicas: 2
  updatedReplicas: 2
[[email protected] mcw]# 
[[email protected] mcw]# kubectl get svc ai-mcwapp-cn-svc -n myprodns -o yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2023-08-21T06:49:37Z"
  name: ai-mcwapp-cn-svc
  namespace: myprodns
  resourceVersion: "67822721"
  uid: 73ed9734-8340-4955-81b1-e7836d23ff75
spec:
  clusterIP: 172.160.13.113
  clusterIPs:
  - 172.160.13.113
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: ai-mcwapp-cn
    port: 9090
    protocol: TCP
    targetPort: 9090
  selector:
    app: ai-mcwapp-cn
    comb: BJ
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
[[email protected] mcw]# 
[[email protected] mcw]# kubectl get svc ai-mcwapp-kong-svc  -n myprodns  -o yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2023-08-21T06:49:37Z"
  name: ai-mcwapp-kong-svc
  namespace: myprodns
  resourceVersion: "67822718"
  uid: 6e7a16a5-4d01-41d2-87e4-64903c9d78a3
spec:
  clusterIP: 172.160.5.133
  clusterIPs:
  - 172.160.5.133
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: ai-mcwapp-cn
    nodePort: 30924
    port: 9090
    protocol: TCP
    targetPort: 9090
  selector:
    app: ai-mcwapp-cn
    comb: BJ
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {}
[[email protected] mcw]#

 

3、详情

[[email protected] mcw]# kubectl describe ingress  ai-mcwapp-cn-ing -n myprodns
Name:             ai-mcwapp-cn-ing
Labels:           app=ai-mcwapp-cn
                  comb=BJ
Namespace:        myprodns
Address:          
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host                   Path  Backends
  ----                   ----  --------
  gatewaykong-prod-api.daqiecn.com  
                         /   ai-mcwapp-cn-svc:9090 (172.161.3.253:9090,172.161.5.250:9090)
Annotations:             kubernetes.io/ingress.class: nginx
Events:                  <none>
[[email protected] mcw]# 
[[email protected] mcw]# kubectl describe deploy  ai-mcwapp-cn-deploy -n myprodns
Name:                   ai-mcwapp-cn-deploy
Namespace:              myprodns
CreationTimestamp:      Sat, 19 Aug 2023 21:12:29 +0800
Labels:                 app=ai-mcwapp-cn
                        comb=BJ
Annotations:            deployment.kubernetes.io/revision: 7
Selector:               app=ai-mcwapp-cn,comb=BJ
Replicas:               2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  0 max unavailable, 1 max surge
Pod Template:
  Labels:  app=ai-mcwapp-cn
           comb=BJ
  Init Containers:
   initgeoip:
    Image:        qa-roc.daqiecn.com/library/geoip:latest
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:
      /usr/local/share/GeoIP from geoipdir (rw)
  Containers:
   app:
    Image:      qa-roc.daqiecn.com/deploy_prod/common-service/ai-mcwapp-cn:v1.6.0_20240930_cn_18980438b
    Port:       9090/TCP
    Host Port:  0/TCP
    Command:
      java
      -Xms2G
      -Xmx2G
      -XX:MetaspaceSize=128M
      -XX:MaxMetaspaceSize=128M
      -Xss256K
      -XX:+UseConcMarkSweepGC
      -XX:CMSFullGCsBeforeCompaction=5
      -XX:+UseCMSCompactAtFullCollection
      -XX:CMSInitiatingOccupancyFraction=80
      -XX:+HeapDumpOnOutOfMemoryError
      -XX:HeapDumpPath=./logs/
      -DserverName=ai-mcwapp
      -jar
      /app.jar
    Limits:
      cpu:     2
      memory:  4000Mi
    Requests:
      cpu:      1
      memory:   2000Mi
    Liveness:   http-get http://:9090/argus/health delay=300s timeout=1s period=10s #success=1 #failure=3
    Readiness:  http-get http://:9090/argus/health delay=300s timeout=1s period=10s #success=1 #failure=3
    Environment:
      SERVER_ENV:                                    ali
      SPRING_PROFILES_ACTIVE:                        ali
      EGG_SERVER_ENV:                                ali
      FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION:  false
      FF_USE_LEGACY_BUILDS_DIR_FOR_DOCKER:           false
      FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER:          false
      JAVA_PROJECT_PATH:                             ai-mcwapp-web
    Mounts:
      /usr/local/share/GeoIP from geoipdir (rw)
   daqieagent:
    Image:       qa-roc.daqiecn.com/app-dev/flume-ali:latest
    Ports:       5000/UDP, 5001/TCP, 5002/TCP, 8125/UDP, 8094/UDP
    Host Ports:  0/UDP, 0/TCP, 0/TCP, 0/UDP, 0/UDP
    Limits:
      cpu:     500m
      memory:  1000Mi
    Requests:
      cpu:        100m
      memory:     300Mi
    Liveness:     exec [/daqie/daqieagent/healthcheck] delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:  <none>
    Mounts:       <none>
  Volumes:
   geoipdir:
    Type:       EmptyDir (a temporary directory that shmcw a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Progressing    True    NewReplicaSetAvailable
  Available      True    MinimumReplicasAvailable
OldReplicaSets:  <none>
NewReplicaSet:   ai-mcwapp-cn-deploy-db694c657 (2/2 replicas created)
Events:          <none>
[[email protected] mcw]# kubectl describe svc  ai-mcwapp-cn-svc -n myprodns
Name:              ai-mcwapp-cn-svc
Namespace:         myprodns
Labels:            <none>
Annotations:       <none>
Selector:          app=ai-mcwapp-cn,comb=BJ
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                172.160.13.113
IPs:               172.160.13.113
Port:              ai-mcwapp-cn  9090/TCP
TargetPort:        9090/TCP
Endpoints:         172.161.3.253:9090,172.161.5.250:9090
Session Affinity:  None
Events:            <none>
[[email protected] mcw]# 
[[email protected] mcw]# kubectl describe svc ai-mcwapp-kong-svc  -n myprodns  
Name:                     ai-mcwapp-kong-svc
Namespace:                myprodns
Labels:                   <none>
Annotations:              <none>
Selector:                 app=ai-mcwapp-cn,comb=BJ
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       172.160.5.133
IPs:                      172.160.5.133
Port:                     ai-mcwapp-cn  9090/TCP
TargetPort:               9090/TCP
NodePort:                 ai-mcwapp-cn  30924/TCP
Endpoints:                172.161.3.253:9090,172.161.5.250:9090
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
[[email protected] mcw]# 

 

另外一个应用的yaml参考

 

标签:cn,参考,ai,9090,yaml,mcwapp,mcw,k8s,com
From: https://www.cnblogs.com/machangwei-8/p/18230090

相关文章

  • k8s-配置资源管理
    一、Secret:1.Secret介绍:Secret是用来保存密码、token、密钥等敏感数据的k8s资源,这类数据虽然也可以存放在Pod或者镜像中,但是放在Secret中是为了更方便的控制如何使用数据,并减少暴露的风险。2.三种类型:●kubernetes.io/service-account-token:由Kubernetes自动创建,......
  • ASP.NET Core 的 Razor 语法参考
    原文链接:https://learn.microsoft.com/zh-cn/aspnet/core/mvc/views/razor?view=aspnetcore-8.0Razor是一种标记语法,用于将基于.NET的代码嵌入网页中。Razor语法由Razor标记、C#和HTML组成。包含Razor的文件通常具有.cshtml文件扩展名。也可在Razor组件文件(......
  • 揭秘YAML:Python中的PyYAML应用
    ......
  • k8s在线修改alertmanager.yml
    简单说明有些情况下,我们可以进入集群查看某些secret的配置,这里如果想修改secret的配置时,没有secrets的源文件,可以采取如下的方案。例如我们需要修改alertmanager.yml的配置:查看导出配置$kubectlgetsecrets-nmonitoringalertmanager-prometheus-alertmanager-o"jsonpat......
  • x264 参考帧管理原理:i_poc 变量
    POCH.264中的POC(PictureOrderCount)用于表示解码帧的显示顺序。当视频码流中存在B帧时,解码顺序和显示顺序可能不一致,因此需要根据POC来重新排列视频帧的显示顺序,以避免跳帧或画面不连贯的问题。具体来说,POC的作用包括:重排显示顺序:POC确保即使在存在B帧的情况下,视频帧......
  • ShardingSphere面试题及参考答案(3万字长文)
    目录什么是ShardingSphere?ShardingSphere的主要组件有哪些?ShardingSphere支持哪些数据库?......
  • 计算机网络-OSI七层参考模型与数据封装
    目录一、网络1、网络的定义2、网络的分类3、网络的作用4、网络的数据传输方式5、网络的数据通讯方式二、OSI七层参考模型1、网络参考模型定义2、分层的意义3、分层与功能4、TCP\IP五层模型  三、参考模型的协议1、物理层2、数据链路层3、网络层4、传输层5、......
  • k8S的kube-proxy相关ipvs
     ipvsadm命令没想到自己之前二进制部署的,也是ipvs代理模式node2上没有装ipvs,也看不了一些ipvs规则 node1上安装ipvsadm,然后就可以看的k8s添加的规则了yuminstallipvsadmbrctl命令k8snode上默认也没有装上这个软件,不过可以安装上,看看容器的网络情况[root@mcwk8s05......
  • python系列&AIi系列(参考性极强):【完全攻略】Gradio:建立机器学习网页APP
    【完全攻略】Gradio:建立机器学习网页APP【完全攻略】Gradio:建立机器学习网页APP前言一、Gradio介绍以及安装1-1、Gradio介绍Gradio:1-2、安装二、快速开始(初步了解)2-1、简单小栗子2-2、多输入多输出2-3、简易聊天机器人三、关键技术3-1、带有样例的输入3-2、提示弹窗3-......
  • Kubernetes——YAML文件编写
    目录一、创建Kubernetes对象YAML文件必备字段1.apiVersion2.kind3.metadata4.spec二、YAML格式基本规范1.结构表示2.键值对3.列表(数组)4.字典(映射)5.数据类型6.注释7.多文档支持8.复杂结构9.示例 三、YAML文件编写1.YAML文件的组成2.生成YAML文件框架2.1--d......