Main Menu

Search

Showing posts with label cri-o how to docs. Show all posts
Showing posts with label cri-o how to docs. Show all posts

CRIO: How to Specify Registry Credentials (Login Username and Password) With Crictl Command?

Following command can be used to Specify Registry Credentials (Login Username and Password) With crictl Command.

Replace private registry hostname and port number in below command.

crictl pull --creds "username:password" private-registry:5000/nginx:latest


Keywords:

crio cri-o crictl command commands credentials credential username password user authenticate authenticating push pushing pull pulling


PODMAN / CRIO: How To Manually Test Pulling Container Images From Oracle Container Registry (OCR) Using Podman & CRIO?

We can manually pull nginx container image from Oracle container registry (OCR) from podman or CRIO to test if they are installed correctly and if the images are getting pulled without issues.

Following commands can be used.

Podman

podman pull container-registry.oracle.com/olcne/nginx:1.17.7

CRIO

crictl pull container-registry.oracle.com/olcne/nginx:1.17.7

Keywords:

pulling pull container containers image images container-registry.oracle.com ocr registries issues problems test check testing checking

CRIO: How To Connect To Insecure Private Container Registry Using OpenSSL Certificates From CRIO

CRIO: How To Connect To Insecure Private Container Registry Using OpenSSL Certificates From CRIO

Follow below steps. Steps in this doc are tested on Oracle Linux OS, but steps would be similar on other Operating systems

1) On the client machine where you have CRIO, Update /etc/containers/registries.conf file with just these entries. Replace localregistry.oracle.com with the local registry host and <port>> with port where you have localregistry listening.

[[registry]]
location = "localregitry.oracle.com:<port>"
insecure = true

2) On the client machine where you have CRIO, Restart system daemon and CRIO.

systemctl daemon-reload

systemctl restart crio

3) Do testing by pulling the images using crictl pull command from insecure container registry. Below is the command.

crictl pull local-registry:<port>/<image location and name>

4) Verify that you can see images using below command.

crictl images

CRI-O: Command To View And Tail CRIO Container Logs

CRI-O: Command To View And Tail CRIO Container Logs

Below command can be used.


crictl logs -f <container-name>

CRI-O: How To Check the CRIO Configuration And Information

CRI-O: How To Check the CRIO Configuration And Information

Below commands can be used.

sudo crio-status config
sudo crio-status info

Below are example outputs.

#sudo crio-status info
WARN[0000] Failed to decode the keys ["storage.options.override_kernel_check"] from "/etc/containers/storage.conf". 
cgroup driver: systemd
storage driver: overlay
storage root: /var/lib/containers/storage
default GID mappings (format <container>:<host>:<size>):
  0:0:4294967295
default UID mappings (format <container>:<host>:<size>):
  0:0:4294967295


#sudo crio-status config
WARN[0000] Failed to decode the keys ["storage.options.override_kernel_check"] from "/etc/containers/storage.conf". 
[crio]
  root = "/var/lib/containers/storage"
  runroot = "/var/run/containers/storage"
  storage_driver = "overlay"
  log_dir = "/var/log/crio/pods"
  version_file = "/var/run/crio/version"
  version_file_persist = "/var/lib/crio/version"
  clean_shutdown_file = "/var/lib/crio/clean.shutdown"
  internal_wipe = true
  [crio.api]
    grpc_max_send_msg_size = 83886080
    grpc_max_recv_msg_size = 83886080
    listen = "/var/run/crio/crio.sock"
    stream_address = "127.0.0.1"
    stream_port = "0"
    stream_enable_tls = false
    stream_tls_cert = ""
    stream_tls_key = ""
    stream_tls_ca = ""
    stream_idle_timeout = ""
  [crio.runtime]
    seccomp_use_default_when_empty = true
    no_pivot = false
    selinux = true
    log_to_journald = false
    drop_infra_ctr = true
    read_only = false
    hooks_dir = ["/usr/share/containers/oci/hooks.d"]
    default_capabilities = ["CHOWN", "DAC_OVERRIDE", "FSETID", "FOWNER", "SETGID", "SETUID", "SETPCAP", "NET_BIND_SERVICE", "KILL"]
    allowed_devices = ["/dev/fuse"]
    cdi_spec_dirs = ["/etc/cdi", "/var/run/cdi"]
    device_ownership_from_security_context = false
    default_runtime = "runc"
    decryption_keys_path = "/etc/crio/keys/"
    conmon = "/usr/libexec/crio/conmon"
    conmon_cgroup = "system.slice"
    seccomp_profile = ""
    apparmor_profile = "crio-default"
    blockio_config_file = ""
    irqbalance_config_file = "/etc/sysconfig/irqbalance"
    rdt_config_file = ""
    cgroup_manager = "systemd"
    default_mounts_file = ""
    container_exits_dir = "/var/run/crio/exits"
    container_attach_socket_dir = "/var/run/crio"
    bind_mount_prefix = ""
    uid_mappings = ""
    minimum_mappable_uid = -1
    gid_mappings = ""
    minimum_mappable_gid = -1
    log_level = "info"
    log_filter = ""
    namespaces_dir = "/var/run"
    pinns_path = "/usr/bin/pinns"
    pids_limit = 0
    log_size_max = -1
    ctr_stop_timeout = 30
    separate_pull_cgroup = ""
    infra_ctr_cpuset = ""
    [crio.runtime.runtimes]
      [crio.runtime.runtimes.kata]
        runtime_config_path = ""
        runtime_path = "/usr/bin/kata-runtime"
        runtime_type = "oci"
        runtime_root = ""
        DisallowedAnnotations = ["io.kubernetes.cri-o.ShmSize", "cpu-load-balancing.crio.io", "cpu-quota.crio.io", "io.kubernetes.cri.rdt-class", "io.kubernetes.cri-o.TrySkipVolumeSELinuxLabel", "io.kubernetes.cri-o.UnifiedCgroup", "io.kubernetes.cri-o.cgroup2-mount-hierarchy-rw", "io.kubernetes.cri-o.Devices", "irq-load-balancing.crio.io", "io.containers.trace-syscall", "io.kubernetes.cri-o.userns-mode"]
        monitor_path = "/usr/libexec/crio/conmon"
        monitor_cgroup = "system.slice"
      [crio.runtime.runtimes.runc]
        runtime_config_path = ""
        runtime_path = "/usr/bin/runc"
        runtime_type = "oci"
        runtime_root = ""
        DisallowedAnnotations = ["io.kubernetes.cri-o.userns-mode", "io.kubernetes.cri-o.cgroup2-mount-hierarchy-rw", "io.kubernetes.cri-o.UnifiedCgroup", "io.kubernetes.cri-o.ShmSize", "io.kubernetes.cri-o.Devices", "cpu-load-balancing.crio.io", "io.containers.trace-syscall", "cpu-quota.crio.io", "irq-load-balancing.crio.io", "io.kubernetes.cri.rdt-class", "io.kubernetes.cri-o.TrySkipVolumeSELinuxLabel"]
        monitor_path = "/usr/libexec/crio/conmon"
        monitor_cgroup = "system.slice"
  [crio.image]
    default_transport = "docker://"
    global_auth_file = ""
    pause_image = "container-registry.oracle.com/olcne/pause:3.7"
    pause_image_auth_file = ""
    pause_command = "/pause"
    signature_policy = ""
    image_volumes = "mkdir"
    big_files_temporary_dir = ""
  [crio.network]
    cni_default_network = ""
    network_dir = "/etc/cni/net.d/"
    plugin_dirs = ["/opt/cni/bin"]
  [crio.metrics]
    enable_metrics = false
    metrics_collectors = ["operations", "operations_latency_microseconds_total", "operations_latency_microseconds", "operations_errors", "image_pulls_by_digest", "image_pulls_by_name", "image_pulls_by_name_skipped", "image_pulls_failures", "image_pulls_successes", "image_pulls_layer_size", "image_layer_reuse", "containers_oom_total", "containers_oom", "processes_defunct", "operations_total", "operations_latency_seconds", "operations_latency_seconds_total", "operations_errors_total", "image_pulls_bytes_total", "image_pulls_skipped_bytes_total", "image_pulls_failure_total", "image_pulls_success_total", "image_layer_reuse_total", "containers_oom_count_total"]
    metrics_port = 9090
    metrics_socket = ""
    metrics_cert = ""
    metrics_key = ""
  [crio.tracing]
    enable_tracing = false
    tracing_endpoint = "0.0.0.0:4317"
    tracing_sampling_rate_per_million = 0
  [crio.stats]
    stats_collection_period = 0

CRI-O: CRICTL Command To Inspect the CRIO Image

Below command can be used.

crictl inspecti <image>

Below is sample output

sudo crictl inspecti aeaa426620287
{
  "status": {
    "id": "aeaa4266202870b7ba0d8fee810894eb453aba3313b53f91e576153533757871",
    "repoTags": [
      "container-registry.oracle.com/olcne/kube-scheduler:v1.24.15"
    ],
    "repoDigests": [
      "container-registry.oracle.com/olcne/kube-scheduler@sha256:b343679503ab970d3a871fe06ad2f38ac22143acb1f8f42c528f15dc7581b419"
    ],
    "size": "168358862",
    "uid": null,
    "username": "",
    "spec": null,
    "pinned": false
  },
  "info": {
    "labels": {
      "io.buildah.version": "1.24.1"
    },
    "imageSpec": {
      "created": "2023-06-28T20:13:17.64382043Z",
      "architecture": "amd64",
      "os": "linux",
      "config": {
        "Env": [
          "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Cmd": [
          "/bin/bash"
        ],
        "Labels": {
          "io.buildah.version": "1.24.1"
        }
      },
      "rootfs": {
        "type": "layers",
        "diff_ids": [
          "sha256:0628316eca4c2a871969d47900ae3948f43e49d32f18b45fe3c251dccf944137",
          "sha256:ae88c8b34aaeee558e49dddd8d013bc97a7f0be288a49ec9a1b2948f2a74c872",
          "sha256:858687ff50547be7d4ac583ab0f299f237d52634b36dc0443f6cf914cf8d65af",
          "sha256:910a37f46f92f5fd827d2b160d032e7d7c0be5e0a0b31136933e23bdd2f80e98",
          "sha256:0d841c74e8c57f24af4b639c6b7904542bec91b8312b505a42dd11c8c54b83b5",
          "sha256:16dbfef62e283022aa5bf7669069cad21faf6793d633dc2a0573ecabb2c34a13"
        ]
      },
      "history": [
        {
          "created": "2023-06-15T22:56:06.187379525Z",
          "created_by": "/bin/sh -c #(nop) ADD file:59eae1d2cc3c7d887c9bd2b0272ec94df71538c75bd83c16ee2a3338a2b8eeae in / "
        },
        {
          "created": "2023-06-15T22:56:07.588871894Z",
          "created_by": "/bin/sh -c #(nop) CMD [\"/bin/bash\"]",
          "empty_layer": true
        },
        {
          "created": "2023-06-28T20:11:28.883580841Z",
          "created_by": "/bin/sh -c #(nop) ARG BINARY",
          "empty_layer": true
        },
        {
          "created": "2023-06-28T20:11:29.488990309Z",
          "created_by": "/bin/sh -c #(nop) ARG VERSION",
          "empty_layer": true
        },
        {
          "created": "2023-06-28T20:13:07.000344956Z",
          "created_by": "|3 BINARY=kube-scheduler VERSION=v1.24.15 https_proxy=http://squid.jx.svc.cluster.local:3128 /bin/sh -c microdnf install -y tar which \u0026\u0026    microdnf clean all \u0026\u0026    rm -rf /var/cache/yum/*"
        },
        {
          "created": "2023-06-28T20:13:10.00032873Z",
          "created_by": "/bin/sh -c #(nop) ADD file:86c34be6b61e4b8c36bcb149692818d8a1755c5582daaf56f1f8d0332f8caa69 in /usr/local/bin/${BINARY} "
        },
        {
          "created": "2023-06-28T20:13:14.000290456Z",
          "created_by": "|3 BINARY=kube-scheduler VERSION=v1.24.15 https_proxy=http://squid.jx.svc.cluster.local:3128 /bin/sh -c test -d /LICENSES || ln -s /usr/share/licenses /LICENSES"
        },
        {
          "created": "2023-06-28T20:13:16.000268081Z",
          "created_by": "/bin/sh -c #(nop) ADD file:f5ab50807331c354ee4381ecec1b84d339966912eea48a069ef5635aa3ba9240 in /LICENSES/kubernetes-${VERSION}/LICENSE "
        },
        {
          "created": "2023-06-28T20:13:18.000166977Z",
          "created_by": "/bin/sh -c #(nop) ADD file:90d809482ad16527c55d3c557bea6f5b410c45222966435cd1eec93358e526fe in /LICENSES/kubernetes-${VERSION}/THIRD_PARTY_LICENSES.txt "
        }
      ]
    }
  }
}

CRI-O: CRICTL Command To List CRIO Images

 Below is crictl command to list the crio images.

crictl images

Below is sample output of how images are shown.

        container-registry.oracle.com/olcne/etcd                      3.5.6               f440fa7240c43       165MB

CRI-O: CRICTL Command To Pull Image From Oracle Container Registry Or Other Registries Into CRIO

Below is CRICTL Command To Pull Image From Oracle Container Registry Or Other Registries Into CRIO. Replace image name and registry name as needed in container-registry.oracle.com/olcne/etcd:3.5.6 to pull desired image. 

           sudo crictl pull container-registry.oracle.com/olcne/etcd:3.5.6

CRI-O: How To Connect To CRIO Pod Process (DevOps)

#sudo crictl exec -i -t <container name> bash

Container name can be obtained from crictl ps command output.

CRI-O: Crictl Command To Check CRIO Version (DevOps)

#sudo crictl version

Below is sample output.

Version:  0.1.0
RuntimeName:  cri-o
RuntimeVersion:  1.24.2
RuntimeApiVersion:  v1