知识改变命运! kubeshere创建mysql发生FailedCreate requested: requests.cpu=500m,requests.memory=2000Mi, used: requests.cpu=0,requests.memory=0, limi_newnew-lskyf博客社区

kubeshere创建mysql发生FailedCreate requested: requests.cpu=500m,requests.memory=2000Mi, used: requests.cpu=0,requests.memory=0, limi

newnew 1年前 ⋅ 1061 阅读 ⋅ 0 个赞

1.错误日志

create Pod mysql-master-v1-0 in StatefulSet mysql-master-v1 failed error: pods "mysql-master-v1-0" is forbidden: exceeded quota: demo-project, 
requested: requests.cpu=500m,requests.memory=2000Mi, used: requests.cpu=0,requests.memory=0, limited: requests.cpu=10m,requests.memory=1Gi

2.观察关键日志

通过日志看出:需要的StatefulSet mysql-master-v1资源超过了所在namespace的资源上限

requested: requests.cpu=500m,requests.memory=2000Mi, used:
requests.cpu=0,requests.memory=0, limited: requests.cpu=10m,requests.memory=1Gi

3.查看配置文件

3.1关键代码片段

        limits:
          cpu: 10m
          memory: 1000Mi
        requests:
          cpu: 10m
          memory: 1000Mi

3.2 shell重点

shell 注意:requests的cpu和memory的值不能超过requests的的cpu和memory的值

3.3修改后的完整配置文件代码如下:

kind: Pod
apiVersion: v1
metadata:
  name: mysql-master-v1-0
  generateName: mysql-master-v1-
  namespace: demo-project
  labels:
    app: mysql-master
    controller-revision-hash: mysql-master-v1-54fb44d7cc
    statefulset.kubernetes.io/pod-name: mysql-master-v1-0
    version: v1
  annotations:
    cni.projectcalico.org/podIP: 10.233.81.241/32
    cni.projectcalico.org/podIPs: 10.233.81.241/32
    kubesphere.io/containerSecrets: ''
    logging.kubesphere.io/logsidecar-config: '{}'
spec:
  volumes:
    - name: volume-jc02z4
      configMap:
        name: mysql-master-cnf
        items:
          - key: my.cnf
            path: my.cnf
        defaultMode: 420
    - name: volume-anhcvf
      persistentVolumeClaim:
        claimName: mysql-master-pvc
    - name: default-token-6kxfm
      secret:
        secretName: default-token-6kxfm
        defaultMode: 420
  containers:
    - name: mysql-master
      image: 'mysql:5.7'
      ports:
        - name: tcp-3306
          containerPort: 3306
          protocol: TCP
        - name: tcp-33060
          containerPort: 33060
          protocol: TCP
      env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: MYSQL_ROOT_PASSWORD
      resources:
        limits:
          cpu: 10m
          memory: 1000Mi
        requests:
          cpu: 10m
          memory: 1000Mi
      volumeMounts:
        - name: volume-jc02z4
          readOnly: true
          mountPath: /etc/mysql
        - name: volume-anhcvf
          mountPath: /var/lib/mysql
        - name: default-token-6kxfm
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
  restartPolicy: Always
  terminationGracePeriodSeconds: 30
  dnsPolicy: ClusterFirst
  serviceAccountName: default
  serviceAccount: default
  nodeName: k8s-node1
  securityContext: {}
  hostname: mysql-master-v1-0
  subdomain: mysql-master
  affinity: {}
  schedulerName: default-scheduler
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
  priority: 0
  enableServiceLinks: true


全部评论: 0

    我有话说:

    npm ERR! network request to...getaddrinfo ENOTFOUND cdn.npmmirror.com

    错误现象: 安装elementplus出现错误 npm ERR! network request to https://cdn.npmmirror.com/packages/%40vueuse

    微信小程序报错request:fail url not in domain list

    微信小程序报错request:fail url not in domain list 登录小程序后台 https://mp.weixin.qq.com/ 选择开发--开发设置--服务器域名--服务器

    Caused by: java. io.I0Exception:The

    Caused by: java. io.I0Exception:The"/xxxx/xxx" 检查建议: 1. 确保服务器目录和部署的服务是同一台机器 2. 确保此目录针对tomcat有访问

    elasticsearch在不断的重启造成的cpu飙升

    有一天测试环境的服务器卡的要死 看看cup已经飙升到了190% 瞬间蒙圈了 我做了这些步骤发现是因为elasticsearch造成的 1.通过top查询cpu占有率最高的进程编号(pid) ps

    mysql5.7x升级到mysql8.0.3产生的错误

    错误日志 2023:05:03 01:10:36.305 ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper ? - Table 'db_mblog.TBL_USER_EXTEND' do...

    java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

    今天连接数据库老是报这个错误 java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES

    spring boot项目本地没问题,部署到服务器mysql报错:errorCode 0, state 08S01

    错误现象: 在开发的时候没有报错,能正常运行并且能连接服务器。但是部署到服务器报错。 错误如下: 2023-04-07 11:54:40.617 ERROR 7 --- [reate-511707818] com.alibaba.druid.po...

    面试题:MySQL参数innodb_flush_log_at_trx_commit有什么作用?

    面试题:MySQL参数innodb_flush_log_at_trx_commit有什么作用? innodb_flush_log_at_trx_commit是MySQL中InnoDB存储引擎的一个

    送您一个最高2000元的阿里云大礼包,快来领取吧~

    送您一个最高2000元的阿里云大礼包,快来领取吧~ ----> 点击领取阿里云大礼包<----

    MySQL中,根据加锁的维度可以将锁划分为哪些类型呢?

    问题: 在MySQL中,根据加锁的维度可以将锁划分为哪些类型呢? 答案: 按读写权限划分: 共享锁(Shared Locks,简称S):在事物要读取一条记录时,需要先获取该记录的S锁,S锁可以在同一

    docker笔记7-docker-compose搭建mysql主从复制

    1.配置docker-compose 1.1.上传主docker-compose.yml,主要配置server-id=1,read-only=0,端口号为3306 docker-compose

    加入公众号
    加入公众号