zoukankan      html  css  js  c++  java
  • k8s + katacontainer

    root@ubuntu:/opt/gopath/src/github.com/kata-containers/tests/.ci# go version
    go version go1.14.6 linux/arm64
    root@ubuntu:/home/ubuntu# crictl version
    Version:  0.1.0
    RuntimeName:  containerd
    RuntimeVersion:  1.3.7
    RuntimeApiVersion:  v1alpha2
    root@ubuntu:/home/ubuntu# 
    root@ubuntu:/opt/gopath/src/github.com/kata-containers# kata-runtime -v
    kata-runtime  : 1.12.0-alpha1
       commit   : 04c77eb20e9bd603cab5c711bcbe7c69db58b040-dirty
       OCI specs: 1.0.1-dev
     containerd -v
    containerd containerd.io 1.3.7 8fba4e9a7d01810a393d5d25a3621dc101981175
    root@ubuntu:~# kubelet --version
    Kubernetes v1.18.1
    root@ubuntu:~# 
    root@ubuntu:~/kata_container# ctr -n  k8s.io image list 
    REF                                                                                             TYPE                                                      DIGEST                                                                  SIZE      PLATFORMS                                                                                               LABELS                          
    docker.io/library/nginx:latest                                                                  application/vnd.docker.distribution.manifest.list.v2+json sha256:ed7f815851b5299f616220a63edac69a4cc200e7f536a56e421988da82e44ed8 49.9 MiB  linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x io.cri-containerd.image=managed 
    docker.io/library/nginx@sha256:ed7f815851b5299f616220a63edac69a4cc200e7f536a56e421988da82e44ed8 application/vnd.docker.distribution.manifest.list.v2+json sha256:ed7f815851b5299f616220a63edac69a4cc200e7f536a56e421988da82e44ed8 49.9 MiB  linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x io.cri-containerd.image=managed 
    k8s.gcr.io/coredns:1.6.7                                                                        application/vnd.docker.distribution.manifest.v2+json      sha256:19910cb28a673d9ad642c3762b71fb5da6668537d9417d14d4d0cbf82569d7a8 37.5 MiB  linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/etcd:3.4.3-0                                                                         application/vnd.docker.distribution.manifest.v2+json      sha256:178fd81a3b4e28d724189d6fbf2e1ec14235c011244cdefaf3776a8c6efe736e 348.0 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/kube-apiserver:v1.18.1                                                               application/vnd.docker.distribution.manifest.v2+json      sha256:4e6eac64d7f50e27153e3d8e893bcce905a8f703304cb98fc790c10235420cf5 161.7 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/kube-controller-manager:v1.18.1                                                      application/vnd.docker.distribution.manifest.v2+json      sha256:fbf4c7aa6884758c4cc5335915e3ac42e37298a10af314e98c634c76b340d3a6 151.9 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/kube-proxy:v1.18.1                                                                   application/vnd.docker.distribution.manifest.v2+json      sha256:ca20e594512e5a660fca4d1b5f611c6125606c4c48fcf60622982c87e1684d2c 111.3 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/kube-scheduler:v1.18.1                                                               application/vnd.docker.distribution.manifest.v2+json      sha256:86b094f6dd45ca88a1fb044d3a027f84c8de181f9f675c16275ea445d0e9f584 91.7 MiB  linux/amd64                                                                                             io.cri-containerd.image=managed 
    k8s.gcr.io/pause:3.2                                                                            application/vnd.docker.distribution.manifest.v2+json      sha256:c48b9880a653675609eec77591ea2287753644e74930392886a7c7ab2e1c59e5 475.7 KiB linux/arm64                                                                                             io.cri-containerd.image=managed 
    quay.io/coreos/flannel:v0.12.0-arm64                                                            application/vnd.docker.distribution.manifest.v2+json      sha256:a2f5081b71ee4688d0c7693d7e5f2f95e9eea5ea3b4147a12179f55ede42c185 16.9 MiB  linux/arm64                                                                                             io.cri-containerd.image=managed 
    quay.io/coreos/flannel@sha256:a2f5081b71ee4688d0c7693d7e5f2f95e9eea5ea3b4147a12179f55ede42c185  application/vnd.docker.distribution.manifest.v2+json      sha256:a2f5081b71ee4688d0c7693d7e5f2f95e9eea5ea3b4147a12179f55ede42c185 16.9 MiB  linux/arm64                                                                                             io.cri-containerd.image=managed 
    sha256:06f5d281b70d7b897894065cb8848cdfbca5d0da41ce5fa428befbf0d2850123                         application/vnd.docker.distribution.manifest.v2+json      sha256:4e6eac64d7f50e27153e3d8e893bcce905a8f703304cb98fc790c10235420cf5 161.7 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    sha256:0db9714b83c0297a5b18c6ed1f8473d34f55786f3758fb827c58f788929d068a                         application/vnd.docker.distribution.manifest.v2+json      sha256:fbf4c7aa6884758c4cc5335915e3ac42e37298a10af314e98c634c76b340d3a6 151.9 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    sha256:2a060e2e7101d419352bf82c613158587400be743482d9a537ec4a9d1b4eb93c                         application/vnd.docker.distribution.manifest.v2+json      sha256:c48b9880a653675609eec77591ea2287753644e74930392886a7c7ab2e1c59e5 475.7 KiB linux/arm64                                                                                             io.cri-containerd.image=managed 
    sha256:67db404dfc584db0deebe9956897800e74189856b840968f48a9652ffc87ae9e                         application/vnd.docker.distribution.manifest.v2+json      sha256:19910cb28a673d9ad642c3762b71fb5da6668537d9417d14d4d0cbf82569d7a8 37.5 MiB  linux/amd64                                                                                             io.cri-containerd.image=managed 
    sha256:7cf4a417daaaca6291a76def3946f8ca8b62ce827e1a9282003c82003ba3259c                         application/vnd.docker.distribution.manifest.v2+json      sha256:a2f5081b71ee4688d0c7693d7e5f2f95e9eea5ea3b4147a12179f55ede42c185 16.9 MiB  linux/arm64                                                                                             io.cri-containerd.image=managed 
    sha256:ab707b0a0ea339254cc6e3f2e7d618d4793d5129acb2288e9194769271404952                         application/vnd.docker.distribution.manifest.v2+json      sha256:178fd81a3b4e28d724189d6fbf2e1ec14235c011244cdefaf3776a8c6efe736e 348.0 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    sha256:c82794c0f3c6548f47c9c427a1bd38ed1315757d6d2254b92edc2b224d04d899                         application/vnd.docker.distribution.manifest.list.v2+json sha256:ed7f815851b5299f616220a63edac69a4cc200e7f536a56e421988da82e44ed8 49.9 MiB  linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x io.cri-containerd.image=managed 
    sha256:f0a76adbc24484231b02f85edb0b32f7e922b57425ca4399cbd50c6c78a5beb7                         application/vnd.docker.distribution.manifest.v2+json      sha256:86b094f6dd45ca88a1fb044d3a027f84c8de181f9f675c16275ea445d0e9f584 91.7 MiB  linux/amd64                                                                                             io.cri-containerd.image=managed 
    sha256:f782b1121865ffcfef531a61ecfca31a8cbf2458423cd970d6317e2dac30e9f9                         application/vnd.docker.distribution.manifest.v2+json      sha256:ca20e594512e5a660fca4d1b5f611c6125606c4c48fcf60622982c87e1684d2c 111.3 MiB linux/amd64                                                                                             io.cri-containerd.image=managed 
    root@ubuntu:~/kata_container# ctr -n  k8s.io image list 

    拉取镜像

    ctr images pull docker.io/library/nginx:alpine
    kata-runtime.yaml   kubectl apply -f kata-runtime.yaml
    root@ubuntu:~# cat kata-runtime.yaml 
    kind: RuntimeClass
    apiVersion: node.k8s.io/v1beta1
    metadata:
      name: kata
    handler: kata
    kata-nginx.yaml  kubectl apply -f kata-nginx.yaml
    root@ubuntu:~# cat kata-nginx.yaml 
    apiVersion: v1
    kind: Pod
    metadata:
      name: kata-nginx
    spec:
      runtimeClassName: kata
      containers:
        - name: nginx
          image: nginx
          ports:
          - containerPort: 80
    root@ubuntu:~#
    root@ubuntu:~# cat /etc/crictl.yaml 
    runtime-endpoint: unix:///run/containerd/containerd.sock
    image-endpoint: unix:///run/containerd/containerd.sock
    timeout: 10
    debug: false
    root@ubuntu:~# kubectl taint nodes --all node-role.kubernetes.io/master-
    node/ubuntu untainted
    root@ubuntu:~# kubectl describe pod kata-nginx
    Name:         kata-nginx
    Namespace:    default
    Priority:     0
    Node:         ubuntu/10.10.16.82
    Start Time:   Fri, 16 Oct 2020 17:17:48 +0800
    Labels:       <none>
    Annotations:  Status:  Pending
    IP:           
    IPs:          <none>
    Containers:
      nginx:
        Container ID:   
        Image:          nginx
        Image ID:       
        Port:           80/TCP
        Host Port:      0/TCP
        State:          Waiting
          Reason:       ContainerCreating
        Ready:          False
        Restart Count:  0
        Environment:    <none>
        Mounts:
          /var/run/secrets/kubernetes.io/serviceaccount from default-token-ckv9x (ro)
    Conditions:
      Type              Status
      Initialized       True 
      Ready             False 
      ContainersReady   False 
      PodScheduled      True 
    Volumes:
      default-token-ckv9x:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  default-token-ckv9x
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                     node.kubernetes.io/unreachable:NoExecute for 300s
    Events:
      Type     Reason            Age        From               Message
      ----     ------            ----       ----               -------
      Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.
      Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.
      Normal   Scheduled         <unknown>  default-scheduler  Successfully assidocker.io/library/nginx:alpine: 
    root@ubuntu:~# kubectl exec -it kata-nginx sh
    kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
    # ls
    bin   docker-entrypoint.d   home   mnt   root  srv  usr
    boot  docker-entrypoint.sh  lib    opt   run   sys  var
    dev   etc                   media  proc  sbin  tmp
    # 
    root@ubuntu:/etc/kubernetes# ps -elf | grep containerd
    0 S root     12336     1  0  80   0 - 27806 futex_ 17:13 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 2bb7afab3e57b8b90e043e7ce8e91776f2eaa9fd2be80a44ffe7c89f4847165b -address /run/containerd/containerd.sock
    0 S root     12361     1  0  80   0 - 27806 futex_ 17:13 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 6552879e24792545390dbf29f6dbf11b7b8fd702008e7d18dd7c44436fc855e4 -address /run/containerd/containerd.sock
    4 S root     12848     1  5  80   0 - 1566815 futex_ 17:13 ?      00:00:49 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=/run/containerd/containerd.sock --resolv-conf=/run/systemd/resolve/resolv.conf --container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock
    0 S root     13100     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id b3d3c127c1c96386cb7e474e5f0cb8e276b4b1169495430c96c2cae2ccdb2ecc -address /run/containerd/containerd.sock
    0 S root     13253     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 1988fd9b2f17464c4ae75d2234461598ba4d30f7a527a8384c8db9b8328c42ef -address /run/containerd/containerd.sock
    0 S root     13444     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id a008e2019e6c57d34540c7477e6fe336094db8c1bd49a0ff2f1ef82f72b5c35d -address /run/containerd/containerd.sock
    0 S root     13591     1  0  80   0 - 27454 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 67b07bb222155a396b88bbf87e876ddffbcc3d84f97771f5d39667819ffba45c -address /run/containerd/containerd.sock
    0 S root     13615     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 7908ed5bbf4ae93ca182bd4efdfe69e8021395d478b43cd040babf3de239d10b -address /run/containerd/containerd.sock
    0 S root     13654     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id ec31c0c9937c1edaaf8e492c55d8c231b049a46979336b71648a4c50e19df37c -address /run/containerd/containerd.sock
    0 S root     13761     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id fe8bed0d99d699bd0a240ee70e665c072b9540aa4dbaf00cdd3f7e4c2c3a6a39 -address /run/containerd/containerd.sock
    0 S root     13798     1  0  80   0 - 27806 futex_ 17:14 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id df208be1374b7003c0635f69c001b15911aba745d554c5e001ccbd5cff7f5b59 -address /run/containerd/containerd.sock
    0 S root     14617     1  0  80   0 - 27454 futex_ 17:16 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 2b8de09ac29068572e0720c8fe4e991a43c425c8a4c40195fbc121d46768ce24 -address /run/containerd/containerd.sock
    0 S root     14829     1  0  80   0 - 27806 futex_ 17:16 ?        00:00:00 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id e0092669baeee5a9daa953df431499a0474c1935d978787a8e3f71b9d866c11e -address /run/containerd/containerd.sock
    0 S root     15438     1  0  80   0 - 328819 futex_ 17:17 ?       00:00:01 /usr/local/bin/containerd-shim-kata-v2 -namespace k8s.io -address /run/containerd/containerd.sock -publish-binary /usr/bin/containerd -id 96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146 -debug
    0 S root     19122 56922  0  80   0 -  1097 pipe_w 17:30 pts/3    00:00:00 grep --color=auto containerd
    4 S root     21667     1  2  80   0 - 1496512 futex_ 16:02 ?      00:01:50 /usr/bin/containerd
    0 S root     33824     1  0  80   0 - 27806 futex_ 09:47 ?        00:00:02 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id f6cbd0a77bee3a313fd8f8417166315a5c0f19212caba3f4aa95061bb943dfe1 -address /run/containerd/containerd.sock
    0 S root     33945     1  0  80   0 - 27806 futex_ 09:47 ?        00:00:02 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 31246780d074d791990a0c68b562f84bdd821834fb53def9bdf0183f978aaa99 -address /run/containerd/containerd.sock
    0 S root     34005     1  0  80   0 - 27806 futex_ 09:47 ?        00:00:02 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id ad48842a9a8d481fbd20a936860ec9243a4892f2e6e9c064ab5093cf083ba0fd -address /run/containerd/containerd.sock
    0 S root     34079     1  0  80   0 - 27806 futex_ 09:47 ?        00:00:02 /usr/bin/containerd-shim-runc-v1 -namespace k8s.io -id 6a57995cd991dd4e2c41c1421ab53880cd3d39a84f804194ed4fd1bc80a85cc4 -address /run/containerd/containerd.sock
    root@ubuntu:/etc/kubernetes#
    root@ubuntu:~# ps -elf | grep qemu
    7 S root     15451     1  0  80   0 - 753697 sys_po 17:17 ?       00:00:07 /usr/bin/qemu-system-aarch64 -name sandbox-96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146 -uuid 67b88fe7-cd3c-4a6d-b436-19d29be7d40e -machine virt,usb=off,accel=kvm,gic-version=host -cpu host,pmu=off -qmp unix:/run/vc/vm/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146/qmp.sock,server,nowait -m 2048M,slots=10,maxmem=257176M -device pcie-pci-bridge,bus=pcie.0,id=pcie-bridge-0,addr=2,romfile= -device virtio-serial-pci,disable-modern=false,id=serial0,romfile= -device virtconsole,chardev=charconsole0,id=console0 -chardev socket,id=charconsole0,path=/run/vc/vm/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146/console.sock,server,nowait -device virtio-blk-pci,disable-modern=false,drive=image-fcbf7f73a47cd6bc,scsi=off,config-wce=off,romfile=,share-rw=on -drive id=image-fcbf7f73a47cd6bc,file=/usr/share/kata-containers/binary/kata-containers.img,aio=threads,format=raw,if=none,readonly -device virtio-scsi-pci,id=scsi0,disable-modern=false,romfile= -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0,romfile= -device virtserialport,chardev=charch0,id=channel0,name=agent.channel.0 -chardev socket,id=charch0,path=/run/vc/vm/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146/kata.sock,server,nowait -device virtio-9p-pci,disable-modern=false,fsdev=extra-9p-kataShared,mount_tag=kataShared,romfile= -fsdev local,id=extra-9p-kataShared,path=/run/kata-containers/shared/sandboxes/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146/shared,security_model=none -netdev tap,id=network-0,vhost=on,vhostfds=3,fds=4 -device driver=virtio-net-pci,netdev=network-0,mac=22:9a:d3:1f:e3:49,disable-modern=false,mq=on,vectors=4,romfile= -rtc base=utc,driftfix=slew,clock=host -global kvm-pit.lost_tick_policy=discard -vga none -no-user-config -nodefaults -nographic --no-reboot -daemonize -kernel /usr/share/kata-containers/binary/vmlinuz-5.4.34-88 -append console=hvc0 console=hvc1 iommu.passthrough=0 root=/dev/vda1 rootflags=data=ordered,errors=remount-ro ro rootfstype=ext4 quiet systemd.show_status=false panic=1 nr_cpus=64 agent.use_vsock=false systemd.unit=kata-containers.target systemd.mask=systemd-networkd.service systemd.mask=systemd-networkd.socket scsi_mod.scan=none -pidfile /run/vc/vm/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146/pid -smp 1,cores=1,threads=1,sockets=64,maxcpus=64
    root@ubuntu:~# crictl pods
    POD ID              CREATED             STATE               NAME                             NAMESPACE           ATTEMPT
    96a36a40169dd       26 minutes ago      Ready               kata-nginx                       default             0
    2b8de09ac2906       27 minutes ago      Ready               kube-flannel-ds-arm64-c895t      kube-system         0
    7908ed5bbf4ae       29 minutes ago      Ready               coredns-66bff467f8-gkq4g         kube-system         0
    67b07bb222155       29 minutes ago      Ready               coredns-66bff467f8-54h8n         kube-system         0
    a008e2019e6c5       29 minutes ago      Ready               kube-proxy-896mz                 kube-system         0
    6a57995cd991d       8 hours ago         Ready               etcd-ubuntu                      kube-system         0
    ad48842a9a8d4       8 hours ago         Ready               kube-scheduler-ubuntu            kube-system         0
    31246780d074d       8 hours ago         Ready               kube-controller-manager-ubuntu   kube-system         0
    f6cbd0a77bee3       8 hours ago         Ready               kube-apiserver-ubuntu            kube-system         0
    root@ubuntu:~# crictl ps
    CONTAINER ID        IMAGE               CREATED             STATE               NAME                      ATTEMPT             POD ID
    d811e8590aecb       c82794c0f3c65       26 minutes ago      Running             nginx                     0                   96a36a40169dd
    e0092669baeee       7cf4a417daaac       27 minutes ago      Running             kube-flannel              0                   2b8de09ac2906
    df208be1374b7       67db404dfc584       29 minutes ago      Running             coredns                   0                   7908ed5bbf4ae
    fe8bed0d99d69       67db404dfc584       29 minutes ago      Running             coredns                   0                   67b07bb222155
    ec31c0c9937c1       f782b1121865f       29 minutes ago      Running             kube-proxy                0                   a008e2019e6c5
    1988fd9b2f174       f0a76adbc2448       29 minutes ago      Running             kube-scheduler            3                   ad48842a9a8d4
    b3d3c127c1c96       0db9714b83c02       30 minutes ago      Running             kube-controller-manager   2                   31246780d074d
    6552879e24792       06f5d281b70d7       30 minutes ago      Running             kube-apiserver            1                   f6cbd0a77bee3
    2bb7afab3e57b       ab707b0a0ea33       30 minutes ago      Running             etcd                      1                   6a57995cd991d
    root@ubuntu:~# crictl inspectp 96a36a40169dd
    root@ubuntu:~# crictl inspectp 96a36a40169dd | head -n 2
    {
      "status": {
    root@ubuntu:~# 
    root@ubuntu:~# kata-runtime list
    ID                                                                 PID         STATUS      BUNDLE                                                                                                                  CREATED                          OWNER
    96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146   -1          running     /run/containerd/io.containerd.runtime.v2.task/k8s.io/96a36a40169dd6add5bdf3367a4313bec828a598fb001a45bac7d01bec1f0146   2020-10-16T09:17:50.17411532Z    #0
    d811e8590aecb55091918cefc11cef16665250c878a0646fb04039f7f67d1cd9   -1          running     /run/containerd/io.containerd.runtime.v2.task/k8s.io/d811e8590aecb55091918cefc11cef16665250c878a0646fb04039f7f67d1cd9   2020-10-16T09:18:08.084499379Z   #0
    root@ubuntu:~# 
    root@ubuntu:~# docker  ps -a  -------查不到
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    root@ubuntu:~# ctr c ls  ----------查不到
    CONTAINER    IMAGE    RUNTIME    
    root@ubuntu:~# kubectl describe pod kata-nginx
    Name:         kata-nginx
    Namespace:    default
    Priority:     0
    Node:         ubuntu/10.10.16.82
    Start Time:   Fri, 16 Oct 2020 17:17:48 +0800
    Labels:       <none>
    Annotations:  Status:  Running
    IP:           10.244.0.4
    IPs:
      IP:  10.244.0.4
    root@ubuntu:~# kubectl describe pod kata-busybox
    Name:         kata-busybox
    Namespace:    default
    Priority:     0
    Node:         ubuntu/10.10.16.82
    Start Time:   Sat, 17 Oct 2020 10:13:36 +0800
    Labels:       <none>
    Annotations:  Status:  Pending
    IP:           
    IPs:          <none>
    Containers:
      busybox:
        Container ID:   
        Image:          busybox
        Image ID:       
        Port:           80/TCP
        Host Port:      0/TCP
        State:          Waiting
          Reason:       ContainerCreating
        Ready:          False
        Restart Count:  0
        Environment:    <none>
        Mounts:
          /var/run/secrets/kubernetes.io/serviceaccount from default-token-ckv9x (ro)
    Conditions:
      Type              Status
      Initialized       True 
      Ready             False 
      ContainersReady   False 
      PodScheduled      True 
    Volumes:
      default-token-ckv9x:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  default-token-ckv9x
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                     node.kubernetes.io/unreachable:NoExecute for 300s
    Events:
      Type    Reason     Age        From               Message
      ----    ------     ----       ----               -------
      Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/kata-busybox to ubuntu
      Normal  Pulling    21s        kubelet, ubuntu    Pulling image "busybox"
    root@ubuntu:~# ctr i pull docker.io/library/busybox:latest
    docker.io/library/busybox:latest:                                                 resolved       |++++++++++++++++++++++++++++++++++++++| 
    index-sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d:    done           |++++++++++++++++++++++++++++++++++++++| 
    manifest-sha256:b8946184ce3ad6b4a09ebad2d85e81cfcaadc6897bfae2e9c6e2a4fe6afa6ee0: done           |++++++++++++++++++++++++++++++++++++++| 
    layer-sha256:5dce72bf4214c258df67e297f701d7df67be498cda65fccefd4cd1bf76c8fb7e:    done           |++++++++++++++++++++++++++++++++++++++| 
    config-sha256:65a89d0f03445198bc63008ed5fd1b74d6864c5f96ca6aa9c603e91cbb51b55f:   done           |++++++++++++++++++++++++++++++++++++++| 
    elapsed: 2.8 s                                                                    total:   0.0 B (0.0 B/s)                                         
    unpacking linux/arm64/v8 sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d...
    done
    root@ubuntu:~# kubectl describe pod kata-busybox
    Name:         kata-busybox
    Namespace:    default
    Priority:     0
    Node:         ubuntu/10.10.16.82
    Start Time:   Sat, 17 Oct 2020 10:13:36 +0800
    Labels:       <none>
    Annotations:  Status:  Running
    IP:           10.244.0.5
    IPs:
      IP:  10.244.0.5
    Containers:
      busybox:
        Container ID:   containerd://6a91f780eda7a3b382bc79acec45e8905c2ee63243ba74300145a217e617bf10
        Image:          busybox
        Image ID:       docker.io/library/busybox@sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d
        Port:           80/TCP
        Host Port:      0/TCP
        State:          Running
          Started:      Sat, 17 Oct 2020 10:14:04 +0800
        Ready:          True
        Restart Count:  0
        Environment:    <none>
        Mounts:
          /var/run/secrets/kubernetes.io/serviceaccount from default-token-ckv9x (ro)
    Conditions:
      Type              Status
      Initialized       True 
      Ready             True 
      ContainersReady   True 
      PodScheduled      True 
    Volumes:
      default-token-ckv9x:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  default-token-ckv9x
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                     node.kubernetes.io/unreachable:NoExecute for 300s
    Events:
      Type    Reason     Age        From               Message
      ----    ------     ----       ----               -------
      Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/kata-busybox to ubuntu
      Normal  Pulling    67s        kubelet, ubuntu    Pulling image "busybox"
      Normal  Pulled     40s        kubelet, ubuntu    Successfully pulled image "busybox"
      Normal  Created    40s        kubelet, ubuntu    Created container busybox
      Normal  Started    40s        kubelet, ubuntu    Started container busybox
    root@ubuntu:~# kubectl exec -it  kata-busybox
    Namespace:    defaulterror: you must specify at least one command for the container
    root@ubuntu:~# kubectl exec -it  kata-busybox sh
    kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
    / # ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc fq_codel qlen 1000
        link/ether 32:26:5a:e7:0d:83 brd ff:ff:ff:ff:ff:ff
        inet 10.244.0.5/24 brd 10.244.0.255 scope global eth0
           valid_lft forever preferred_lft forever
        inet6 fe80::3026:5aff:fee7:d83/64 scope link flags 02 
           valid_lft forever preferred_lft forever
    / # ping 8.8.8.8
    PING 8.8.8.8 (8.8.8.8): 56 data bytes
    64 bytes from 8.8.8.8: seq=0 ttl=107 time=26.780 ms
    64 bytes from 8.8.8.8: seq=1 ttl=107 time=24.852 ms
    ^C
    --- 8.8.8.8 ping statistics ---
    2 packets transmitted, 2 packets received, 0% packet loss
    round-trip min/avg/max = 24.852/25.816/26.780 ms
    / # 
    root@ubuntu:/home/ubuntu# kubectl get pods
    NAME           READY   STATUS    RESTARTS   AGE
    kata-busybox   1/1     Running   0          11m
    kata-nginx     1/1     Running   0          17h
    root@ubuntu:/home/ubuntu# 
    root@ubuntu:/home/ubuntu# kubectl get po --all-namespaces -o wide | grep 10.244
    default       kata-busybox                     1/1     Running   0          5m29s   10.244.0.5    ubuntu   <none>           <none>
    default       kata-nginx                       1/1     Running   0          17h     10.244.0.4    ubuntu   <none>           <none>
    kube-system   coredns-66bff467f8-54h8n         1/1     Running   0          17h     10.244.0.3    ubuntu   <none>           <none>
    kube-system   coredns-66bff467f8-gkq4g         1/1     Running   0          17h     10.244.0.2    ubuntu   <none>           <none>
    root@ubuntu:~# kubectl exec -it kata-nginx sh
    kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
    # curl localhost
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>
    # 
    Last login: Sat Oct 17 08:58:10 2020 from 192.168.117.59
    ubuntu@ubuntu:~$ curl    10.244.0.4 
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>
    ubuntu@ubuntu:~$ 
  • 相关阅读:
    Springboot中使用Interceptor(拦截器)
    八大排序之冒泡排序
    八大排序之快速排序
    mysql 用户的增删改与授权
    基于Java8开发接口时,处理Java8中的日期
    Springboot中Filter的使用
    正则校验日期,不考虑闰年和闰月
    正则校验时间,24小时制
    记一下mybatis中foreach循环遇到的一个小问题
    sqlserver中一条语句执行查询与更新
  • 原文地址:https://www.cnblogs.com/dream397/p/13827743.html
Copyright © 2011-2022 走看看