小编B.G*_*.G.的帖子

如何更改 Kubernetes 中运行的 Pod 限制?

我有一个由虚拟机组成的自制 Kubernetes 集群。我的问题是,coredns pod 总是处于 CrashLoopBackOff 状态,过了一段时间它们又回到运行状态,因为什么也没发生。我发现但无法尝试的一个解决方案是将默认内存限制从 170Mi 更改为某些内容更高。由于我不是这方面的专家,我认为这不是一件难事,但我不知道如何更改正在运行的 pod 的配置。这可能是不可能的,但必须有一种方法可以使用新配置重新创建它们。我尝试了 kubectl 补丁,也查找了滚动更新,但我就是想不通。如何更改限制?

这是 pod 数据的相关部分:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    cni.projectcalico.org/podIP: 176.16.0.12/32
  creationTimestamp: 2018-11-18T10:29:53Z
  generateName: coredns-78fcdf6894-
  labels:
    k8s-app: kube-dns
    pod-template-hash: "3497892450"
  name: coredns-78fcdf6894-gnlqw
  namespace: kube-system
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: coredns-78fcdf6894
    uid: e3349719-eb1c-11e8-9000-080027bbdf83
  resourceVersion: "73564"
  selfLink: /api/v1/namespaces/kube-system/pods/coredns-78fcdf6894-gnlqw
  uid: e34930db-eb1c-11e8-9000-080027bbdf83
spec:
  containers:
  - args:
    - -conf
    - /etc/coredns/Corefile
  image: k8s.gcr.io/coredns:1.1.3
  imagePullPolicy: IfNotPresent
  livenessProbe:
    failureThreshold: 5
    httpGet:
      path: /health
      port: 8080
      scheme: HTTP
    initialDelaySeconds: …
Run Code Online (Sandbox Code Playgroud)

kubernetes coredns kubernetes-pod

7
推荐指数
1
解决办法
5405
查看次数

Flutter firebase_message 插件设置错误

我想在我的 Flutter 应用程序中尝试云消息传递,但我总是遇到错误,而且我还没有找到解决方案。我按照此处所述的步骤操作:firebase_messaging

如果我按照可选部分以外的步骤为后台消息创建 Application.java 文件,并且我从 Firebase 向启动的应用程序发送测试消息,我会收到此错误:

java.lang.RuntimeException: Unable to create service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: java.lang.RuntimeException: PluginRegistrantCallback is not set.
   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3577)
   at android.app.ActivityThread.access$1400(ActivityThread.java:200)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689)
   at android.os.Handler.dispatchMessage(Handler.java:106)
   at android.os.Looper.loop(Looper.java:201)
   at android.app.ActivityThread.main(ActivityThread.java:6806)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
E/AndroidRuntime(29468): Caused by: java.lang.RuntimeException: PluginRegistrantCallback is not set.
   at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.startBackgroundIsolate(FlutterFirebaseMessagingService.java:157)
   at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.onCreate(FlutterFirebaseMessagingService.java:77)
   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3565)
Run Code Online (Sandbox Code Playgroud)

对我来说,似乎也需要可选部分,但是当我这样做时,应用程序打开时会出错。出现错误后,应用程序仍然运行,如果我从 Firebase 发送测试消息,应用程序会成功接收它。后来它甚至没有收到消息,但会出现相同的错误。

java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference
   at com.github.adee42.keyboardvisibility.KeyboardVisibilityPlugin.registerWith(KeyboardVisibilityPlugin.java:107)
   at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:22)
   at io.flutter.plugins.Application.registerWith(Application.java:18)
   at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.startBackgroundIsolate(FlutterFirebaseMessagingService.java:164)
   at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.onMethodCall(FirebaseMessagingPlugin.java:133)
   at …
Run Code Online (Sandbox Code Playgroud)

flutter firebase-cloud-messaging

7
推荐指数
2
解决办法
9120
查看次数