Devying / kubecmd

kubectl命令在容器中执行各种程序脚本
0 stars 0 forks source link

请问下, 这个错在哪里? #1

Closed vTNT closed 6 years ago

vTNT commented 6 years ago
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: centos7-python-consul
  labels:
    app: centos7-python-consul
spec:
  replicas: 1
  selector:
    matchLabels:
      app: centos7-python-consul
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  template:
    metadata:
      labels:
        app: centos7-python-consul
    spec:
      containers:
        - name: centos7-python
          image: centos7-python:0.0.1
          imagePullPolicy: Always
          securityContext:
            capabilities:
              add:
              - SYS_MODULE
              - NET_ADMIN
              - SYS_ADMIN
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: PROFILE
              value: "test"
        - name: consul-client
          image: "consul:1.2.0"
          args:
            - "agent"
            - "-advertise=$(PODIP)"
            - "-bind=0.0.0.0"
            - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
            - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
            - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
            - "-client=0.0.0.0"
            - "-datacenter=dc1"
            - "-data-dir=/consul/data"
            - "-domain=cluster.local"
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          lifecycle:
            preStop:
              exec:
                command:
                - /bin/sh
                - -c
                - consul leave
          ports:
            - containerPort: 8500
              name: ui-port
            - containerPort: 8400
              name: alt-port
            - containerPort: 53
              name: udp-port
            - containerPort: 8443
              name: https-port
            - containerPort: 8080
              name: http-port
            - containerPort: 8301
              name: serflan
            - containerPort: 8302
              name: serfwan
            - containerPort: 8600
              name: consuldns
            - containerPort: 8300
              name: server
      imagePullSecrets:
      - name: myregistrykey

我已经在k8s上面了部署了consul cluster,

vTNT commented 6 years ago

get pod 状态是

NAME                                           READY     STATUS        RESTARTS   AGE
centos7-python-consul-544548bc99-49zxv         1/2       Error         2          22s
vTNT commented 6 years ago

descibe pod 内容是

Events:
  Type     Reason     Age               From                Message
  ----     ------     ----              ----                -------
  Normal   Scheduled  1m                default-scheduler   Successfully assigned centos7-python-consul-544548bc99-49zxv to la2-c6220
  Normal   Pulling    1m                kubelet, la2-c6220  pulling image "centos7-python:0.0.1"
  Normal   Pulled     1m                kubelet, la2-c6220  Successfully pulled image "centos7-python:0.0.1"
  Normal   Created    1m                kubelet, la2-c6220  Created container
  Normal   Started    1m                kubelet, la2-c6220  Started container
  Normal   Created    55s (x4 over 1m)  kubelet, la2-c6220  Created container
  Normal   Started    55s (x4 over 1m)  kubelet, la2-c6220  Started container
  Warning  BackOff    17s (x8 over 1m)  kubelet, la2-c6220  Back-off restarting failed container
  Normal   Pulled     4s (x5 over 1m)   kubelet, la2-c6220  Container image "consul:1.2.0" already present on machine