ubuntu18.04 kubernete,pod正在运行,但未找到容器

时间:2018-09-02 11:36:27

标签: docker kubernetes ubuntu-18.04 kube-proxy

我在ubuntu18.04上进行了多合一安装 我可以看到Pod正在运行,容器提供的服务可用,但是 我只是找不到容器。 看起来像这样: Kubernetes pods are running but docker ps does not give any output

$ kubectl get pods
NAME          READY     STATUS    RESTARTS   AGE
mysql-qzbcx   1/1       Running   0          2d
myweb-nv4h8   1/1       Running   0          2d
myweb-vzvk4   1/1       Running   0          2d

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
<empty>

这些是rc和svc yaml文件:

$ cat myweb-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 2
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
      - name: myweb
        image: kubeguide/tomcat-app:v1
        ports:
        - containerPort: 8080

[2018-09-02 07:26:10]pings@ubuntu:~
$ cat myweb-svc.yaml
apiVersion: v1
kind: Service
metadata:
    name: myweb
spec:
    type: NodePort
    ports:
        - port: 8080
          nodePort: 30001
    selector:
        app: myweb

tomcat容器提供的Web服务:

$ sudo netstat -lnap | grep 30001
tcp6       0      0 :::30001                :::*                    LISTEN      1547/kube-proxy

kube-proxy流程等

$ sudo ps aux | grep 1547
root       1547  0.3  0.5  47512 11304 ?        Ssl  Aug31  11:03 /snap/microk8s/149/kube-proxy --master=http://127.0.0.1:8080 --cluster-cidr=10.152.183.0/24 --kubeconfig=/snap/microk8s/149/kubeproxy.config --proxy-mode=userspace
pings     78812  0.0  0.0  21536  1092 pts/0    S+   07:11   0:00 grep --color=auto 1547

$ sudo ps aux | grep kubelet
root      56851  4.7  2.5 1932688 51184 ?       Ssl  Aug31 129:04 /snap/microk8s/149/kubelet --kubeconfig=/snap/microk8s/149/configs/kubelet.config --cert-dir=/var/snap/microk8s/149 --network-plugin=kubenet --root-dir=/var/snap/microk8s/common --docker-root=/var/snap/microk8s/common/var/lib/docker --fail-swap-on=false --feature-gates=DevicePlugins=false --pod-cidr=10.1.1.0/24 --non-masquerade-cidr=10.152.183.0/24 --cni-bin-dir=/snap/microk8s/149/opt/cni/bin/ --docker-endpoint unix:///var/snap/microk8s/149/docker.sock --eviction-hard=memory.available<500Mi,nodefs.available<1Gi,imagefs.available<1Gi
pings     78916  0.0  0.0  21536   980 pts/0    S+   07:13   0:00 grep --color=auto kubelet

$ sudo ps aux | grep proxy
root       1547  0.3  0.5  47512 11304 ?        Ssl  Aug31  11:03 /snap/microk8s/149/kube-proxy --master=http://127.0.0.1:8080 --cluster-cidr=10.152.183.0/24 --kubeconfig=/snap/microk8s/149/kubeproxy.config --proxy-mode=userspace
gdm        2326  0.0  0.0 275728     0 tty1     Sl+  Aug31   0:00 /usr/lib/gnome-settings-daemon/gsd-screensaver-proxy
pings     78971  0.0  0.0  21536  1040 pts/0    S+   07:14   0:00 grep --color=auto proxy

$ ps aux | grep apiserver
root       1489  3.6  8.1 391720 163576 ?       Ssl  Aug31 112:53 /snap/microk8s/149/kube-apiserver --v=4 --insecure-bind-address=0.0.0.0 --cert-dir=/var/snap/microk8s/149 --etcd-servers=unix://etcd.socket:2379 --service-cluster-ip-range=10.152.183.0/24 --authorization-mode=AlwaysAllow --basic-auth-file=/snap/microk8s/149/basic_auth.csv --token-auth-file=/snap/microk8s/149/known_token.csv --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota --service-account-key-file=/var/snap/microk8s/149/certs/serviceaccount.key --client-ca-file=/var/snap/microk8s/149/certs/ca.crt --tls-cert-file=/var/snap/microk8s/149/certs/server.crt --tls-private-key-file=/var/snap/microk8s/149/certs/server.key
pings     79277  0.0  0.0  21536  1020 pts/0    S+   07:20   0:00 grep --color=auto apiserver

tomcat似乎安装在主机中,而不是作为容器安装:

$ ps aux | grep tomcat
root      36638  0.1  6.5 3138168 131764 ?      Ssl  Aug31   5:09 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root      36704  0.2  4.3 3139884 86972 ?       Ssl  Aug31   6:27 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
pings     79053  0.0  0.0  21536  1156 pts/0    S+   07:15   0:00 grep --color=auto tomcat

我认为一定有我不知道的基本知识(目前我是kube新手)。

0 个答案:

没有答案