kubernetes CRI

CRI - コンテナランタイムインターフェイス(インターフェイスランタイムコンテナ)

容器およびランタイムミラーのライフサイクルは、2つのサービスを定義する必要があり、互いに分離されているためCRIは、インターフェイスを定義し、サービスコンテナをミラーリング。インターフェイスが使用するプロトコルバッファベース、GRPCを、Kubernetes V1.10 +バージョンであるpkg/kubelet/apis/cri/runtime/v1alpha2api.proto定義。

CRIアーキテクチャ

コンテナランタイムには、CRI gRPCサーバーを達成RuntimeServiceしてImageServicegRPC Serverは、ローカルUnixソケットに耳を傾ける必要があり、gRPCクライアントとしてkubeletが実行されます。

CRIを有効にします

統合rktnetes、またはCRIない限りKubernetes1.7バージョン、CRIが削除された古いあらかじめ統合ドッキングウィンドウから、デフォルトで有効になっています。

:CRIを有効にするには、単に起動パラメータkubeletで再渡し、このパラメータに必要な--container-runtime-endpointリモート・ランタイムサービスエンドポイント。現在のUnixはLinuxのサポート、Windows上のサポート、TCPのソケット。例えば:unix:///var/run/dockershim.sock、  tcp://localhost:373デフォルトはunix:///var/run/dockershim.sockローカルドッキングウィンドウのデフォルトの実行時間などのコンテナを使用すること。

CRI・インタフェース

CRI Kubernetes 1.9インターフェイスは、api.proto次のように定義されます。

// Runtime service defines the public APIs for remote container runtimes
service RuntimeService {
    // Version returns the runtime name, runtime version, and runtime API version. rpc Version(VersionRequest) returns (VersionResponse) {} // RunPodSandbox creates and starts a pod-level sandbox. Runtimes must ensure // the sandbox is in the ready state on success. rpc RunPodSandbox(RunPodSandboxRequest) returns (RunPodSandboxResponse) {} // StopPodSandbox stops any running process that is part of the sandbox and // reclaims network resources (e.g., IP addresses) allocated to the sandbox. // If there are any running containers in the sandbox, they must be forcibly // terminated. // This call is idempotent, and must not return an error if all relevant // resources have already been reclaimed. kubelet will call StopPodSandbox // at least once before calling RemovePodSandbox. It will also attempt to // reclaim resources eagerly, as soon as a sandbox is not needed. Hence, // multiple StopPodSandbox calls are expected. rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {} // RemovePodSandbox removes the sandbox. If there are any running containers // in the sandbox, they must be forcibly terminated and removed. // This call is idempotent, and must not return an error if the sandbox has // already been removed. rpc RemovePodSandbox(RemovePodSandboxRequest) returns (RemovePodSandboxResponse) {} // PodSandboxStatus returns the status of the PodSandbox. If the PodSandbox is not // present, returns an error. rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {} // ListPodSandbox returns a list of PodSandboxes. rpc ListPodSandbox(ListPodSandboxRequest) returns (ListPodSandboxResponse) {} // CreateContainer creates a new container in specified PodSandbox rpc CreateContainer(CreateContainerRequest) returns (CreateContainerResponse) {} // StartContainer starts the container. rpc StartContainer(StartContainerRequest) returns (StartContainerResponse) {} // StopContainer stops a running container with a grace period (i.e., timeout). // This call is idempotent, and must not return an error if the container has // already been stopped. // TODO: what must the runtime do after the grace period is reached? rpc StopContainer(StopContainerRequest) returns (StopContainerResponse) {} // RemoveContainer removes the container. If the container is running, the // container must be forcibly removed. // This call is idempotent, and must not return an error if the container has // already been removed. rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {} // ListContainers lists all containers by filters. rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {} // ContainerStatus returns status of the container. If the container is not // present, returns an error. rpc ContainerStatus(ContainerStatusRequest) returns (ContainerStatusResponse) {} // UpdateContainerResources updates ContainerConfig of the container. rpc UpdateContainerResources(UpdateContainerResourcesRequest) returns (UpdateContainerResourcesResponse) {} // ExecSync runs a command in a container synchronously. rpc ExecSync(ExecSyncRequest) returns (ExecSyncResponse) {} // Exec prepares a streaming endpoint to execute a command in the container. rpc Exec(ExecRequest) returns (ExecResponse) {} // Attach prepares a streaming endpoint to attach to a running container. rpc Attach(AttachRequest) returns (AttachResponse) {} // PortForward prepares a streaming endpoint to forward ports from a PodSandbox. rpc PortForward(PortForwardRequest) returns (PortForwardResponse) {} // ContainerStats returns stats of the container. If the container does not // exist, the call returns an error. rpc ContainerStats(ContainerStatsRequest) returns (ContainerStatsResponse) {} // ListContainerStats returns stats of all running containers. rpc ListContainerStats(ListContainerStatsRequest) returns (ListContainerStatsResponse) {} // UpdateRuntimeConfig updates the runtime configuration based on the given request. rpc UpdateRuntimeConfig(UpdateRuntimeConfigRequest) returns (UpdateRuntimeConfigResponse) {} // Status returns the status of the runtime. rpc Status(StatusRequest) returns (StatusResponse) {} } // ImageService defines the public APIs for managing images. service ImageService { // ListImages lists existing images. rpc ListImages(ListImagesRequest) returns (ListImagesResponse) {} // ImageStatus returns the status of the image. If the image is not // present, returns a response with ImageStatusResponse.Image set to // nil. rpc ImageStatus(ImageStatusRequest) returns (ImageStatusResponse) {} // PullImage pulls an image with authentication config. rpc PullImage(PullImageRequest) returns (PullImageResponse) {} // RemoveImage removes the image. // This call is idempotent, and must not return an error if the image has // already been removed. rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {} // ImageFSInfo returns information of the filesystem that is used to store images. rpc ImageFsInfo(ImageFsInfoRequest) returns (ImageFsInfoResponse) {} } 

これは、2つのgRPCサービスが含まれています。
  • RuntimeService:Managementコンテナとサンドボックスのランタイム。
  • ImageServiceは:倉庫、ビューから引き出さミラーを提供し、ミラーリングされたRPCを取り除きます。

CRIの現在のバックエンドサポート

私たちは、最初はKubernetesの使用で実際には、開始Kubernetes 1.5からCRIをサポートするために始めたとき、ドッカーコンテナとして動作して、通常のデフォルトは、アルファ版では現在、あなたはCRI・インターフェースによってポッド他のコンテナ・ランタイム用としてバックエンドを指定することができ、現在サポートCRIの後端部は、次のとおりです。

  • CRI-O:CRI CRI-O Kubernetes標準を達成し、Kubernetes OCI準拠容器許可さを間接的に作動用いられる中間層Kubernetes OCI準拠容器をランタイムと、CRI-Oを使用することができます。
  • containerd-CRI:ベースのContainerdの Kubernetes CRIの実現
  • RKT:CoreOSドッキングウィンドウコンテナランタイムと競合するメインプッシュ
  • frakti:ハイパーバイザベースのCRI
  • ドッカー:kuberentesは、第一の容器のランタイムをサポートするために、まだ完全に、ドッキングウィンドウの会社も宣伝にkubeletから切り離されるようになったOCIの標準

CRIは、SIG-ノードを維持します。

バックエンドCRI CRI-Oを通る電流の間接的なサポート

また、そこにいくつかの現在の達成だけですOCI標準コンテナは、しかし、ランタイムとして彼らができるCRI-O Kubernetesコンテナ。CRI CRI-Oは、標準Kubernetesが実装、およびOCI Kubernetes間接的に互換性のある実行時の容器の使用を可能にします。

  • コンテナクリア:インテルはOCI互換のランタイムコンテナが立ち上げた、CRI CRI-Oによって互換性があることができます。
  • コンテナのカタ:OCI会うの仕様、またはCRI-OによってContainerd CRIプラグイン CRIとの互換性のため。
  • gVisor:Googleは、コンテナのランタイムサンドボックス(実験)を立ち上げたCRI CRI-Oによって互換性があることができます。

おすすめ

転載: www.cnblogs.com/peteremperor/p/12177400.html