kubernetes 使用YAML的k3群集上的节点红色不起作用

yqkkidmi  于 12个月前  发布在  Kubernetes
关注(0)|答案(1)|浏览(87)

我正在尝试部署一个简单的node-red应用程序到我的k3 s容器。背景我有两个pi 4作为我的服务器和3B+作为我的工人。
对于错误,

NAME                       READY   STATUS             RESTARTS   AGE
nodered-559875dbbd-mn474   0/1     CrashLoopBackOff   11         36m

字符串
这是我的yaml文件

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: nodered
  name: nodered
  namespace: nodered
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: nodered
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.22.0 (955b78124)
      creationTimestamp: null
      labels:
        io.kompose.service: nodered
    spec:
      containers:
        - image: nodered/node-red
          name: nodered
          ports:
            - containerPort: 1880
          livenessProbe:
            httpGet:
              path: /
              port: 80
            initialDelaySeconds: 2
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /
              port: 80
            initialDelaySeconds: 2
            periodSeconds: 10
          resources: {}
          volumeMounts:
            - mountPath: /data
              name: nodered-claim0
      restartPolicy: Always
      securityContext:
        runAsUser: 0
      volumes:
        - name: nodered-claim0
          persistentVolumeClaim:
            claimName: nodered-claim0
status: {}
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: nodered
  name: nodered
  namespace: nodered
spec:
  ports:
    - name: "1880"
      port: 80
      targetPort: 1880
  selector:
    io.kompose.service: nodered
status:
  loadBalancer: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: nodered-claim0
  name: nodered-claim0
  namespace: nodered
spec:
  storageClassName: longhorn
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
status: {}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nodered-ingress
  namespace: nodered
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
  rules:
  - host: nodered.local
    http:
      paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: nodered
              port: 
                number: 80


下面是当我输入describe节点时得到的错误

Name:         nodered-559875dbbd-mn474
Namespace:    nodered
Priority:     0
Node:         masternode/192.168.1.120
Start Time:   Tue, 27 Apr 2021 10:38:28 -0400
Labels:       io.kompose.service=nodered
              pod-template-hash=559875dbbd
Annotations:  kompose.cmd: kompose convert
              kompose.version: 1.22.0 (955b78124)
Status:       Running
IP:           10.42.1.197
IPs:
  IP:           10.42.1.197
Controlled By:  ReplicaSet/nodered-559875dbbd
Containers:
  nodered:
    Container ID:   containerd://af3290fa34138a3361d5d73b7c1872eb1c523cefb0b8c17195db5d99c609f9fb
    Image:          nodered/node-red
    Image ID:       docker.io/nodered/node-red@sha256:f16e1ec7265829bcc381009dec175d9fbbc050ab6a1c42c4c906e689ff3bcf6b
    Port:           1880/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Tue, 27 Apr 2021 10:38:52 -0400
      Finished:     Tue, 27 Apr 2021 10:38:52 -0400
    Ready:          False
    Restart Count:  2
    Liveness:       http-get http://:80/ delay=2s timeout=1s period=10s #success=1 #failure=3
    Readiness:      http-get http://:80/ delay=2s timeout=1s period=10s #success=1 #failure=3
    Environment:    <none>
    Mounts:
      /data from nodered-claim0 (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-j2f7l (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  nodered-claim0:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  nodered-claim0
    ReadOnly:   false
  default-token-j2f7l:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-j2f7l
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  37s                default-scheduler  Successfully assigned nodered/nodered-559875dbbd-mn474 to masternode
  Normal   Pulled     33s                kubelet            Successfully pulled image "nodered/node-red" in 495.427449ms
  Normal   Pulled     32s                kubelet            Successfully pulled image "nodered/node-red" in 504.720641ms
  Normal   Pulling    14s (x3 over 34s)  kubelet            Pulling image "nodered/node-red"
  Normal   Pulled     14s                kubelet            Successfully pulled image "nodered/node-red" in 506.632077ms
  Normal   Created    13s (x3 over 33s)  kubelet            Created container nodered
  Normal   Started    13s (x3 over 33s)  kubelet            Started container nodered
  Warning  BackOff    6s (x5 over 30s)   kubelet            Back-off restarting failed container


最后,日志显示以下内容:

internal/modules/cjs/loader.js:800
    throw err;
    ^

SyntaxError: /usr/local/lib/node_modules/npm/package.json: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:797:27)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)


我似乎无法追溯到我的日志问题或至少不知道在哪里寻找。任何帮助是apprecaited

wh6knrhe

wh6knrhe1#

对于那些想知道我得到了这个工作.由于某种原因,它是冲突的安装节点js.不知道为什么.卸载nodejs和重新安装,一切都是工作.所以没有错的配置文件上面的那些想使用它.一旦你绑定你的配置到一个卷,你可以添加身份验证以及.

相关问题