K8s deployed nacos cluster, but encountered an exception after running for a period of time

daupos2t  于 5个月前  发布在  Nacos
关注(0)|答案(1)|浏览(95)

Hello, we deployed the Nacos cluster using k8s and after running for a period of time, the following exception occurred

Exception in thread "nacos-grpc-client-executor-nacos-2.nacos.c3iot.svc.cluster.local-42446320" java.lang.OutOfMemoryError: unable to create new native thread

The YAML file is as follows,nacos version 2.2.0

apiVersion: v1
kind: Service
metadata:
  name: nacos
  namespace: iot
  labels:
    app: nacos
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - port: 8848
      name: server
      targetPort: 8848
    - port: 9848
      name: client-rpc
      targetPort: 9848
    - port: 9849
      name: raft-rpc
      targetPort: 9849
      ## 兼容1.4.x版本的选举端口
    - port: 7848
      name: old-raft-rpc
      targetPort: 7848
  selector:
    app: nacos

apiVersion: v1
kind: Service
metadata:
  name: nacos-headless
  namespace: iot
  labels:
    app: nacos-headless
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - port: 8848
      name: server
      targetPort: 8848
    - port: 9848
      name: client-rpc
      targetPort: 9848
    - port: 9849
      name: raft-rpc
      targetPort: 9849
      ## 兼容1.4.x版本的选举端口
    - port: 7848
      name: old-raft-rpc
      targetPort: 7848
  selector:
    app: nacos

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: iot
  name: nacos-cm
data:
  mysql.host: "external-mysql"
  mysql.db.name: "nacos"
  mysql.port: "3306"
  mysql.user: "root"
  mysql.password: "iot@123"
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: iot
  name: nacos
  labels:
    app: nacos
spec:
  serviceName: nacos
  replicas: 3
  template:
    metadata:
      labels:
        app: nacos
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - nacos
              topologyKey: kubernetes.io/hostname
      # tolerations:
      # - key: "node.kubernetes.io/unreachable"
      #   operator: "Exists"
      #   effect: "NoExecute"
      #   tolerationSeconds: 300
      containers:
        - name: nacos
          imagePullPolicy: IfNotPresent
          image: xxx/tools/nacos:2.2.0
          resources:
            requests:
              memory: "1Gi"
              cpu: "500m"
          ports:
            - containerPort: 8848
              name: client
            - containerPort: 9848
              name: client-rpc
            - containerPort: 9849
              name: raft-rpc
            - containerPort: 7848
              name: old-raft-rpc
          env:
            - name: NACOS_REPLICAS
              value: "3"
            - name: MYSQL_SERVICE_HOST
              valueFrom:
                configMapKeyRef:
                  name: nacos-cm
                  key: mysql.host
            - name: MYSQL_SERVICE_DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: nacos-cm
                  key: mysql.db.name
            - name: MYSQL_SERVICE_PORT
              valueFrom:
                configMapKeyRef:
                  name: nacos-cm
                  key: mysql.port
            - name: MYSQL_SERVICE_USER
              valueFrom:
                configMapKeyRef:
                  name: nacos-cm
                  key: mysql.user
            - name: MYSQL_SERVICE_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: nacos-cm
                  key: mysql.password
            - name: SPRING_DATASOURCE_PLATFORM
              value: "mysql"
            - name: MODE
              value: "cluster"
            - name: NACOS_SERVER_PORT
              value: "8848"
            - name: PREFER_HOST_MODE
              value: "hostname"
            - name: NACOS_SERVERS
              value: "nacos-0.nacos.c3iot.svc.cluster.local:8848 nacos-1.nacos.c3iot.svc.cluster.local:8848 nacos-2.nacos.c3iot.svc.cluster.local:8848"
            - name: management.endpoints.web.exposure.include
              value: prometheus
            - name: db_pool_config_connectionTimeout
              value: "60000"

Due to the lack of some runtime information, we are unable to determine the likelihood of this situation occurring,How should we investigate

w8biq8rn

w8biq8rn1#

can you run a example java program, print how many of Runtime.getRuntime().availableProcessors() .

相关问题