Outils pour utilisateurs

Outils du site


blog

CRI runtimes - Container Runtime Interface

Brouillon

Voir :

Voir Docker est mort :

CRI runtimes - Container Runtime Interface

Voir :

https://www.mirantis.com/blog/cri-dockerd-faq-blog/ dockershim and cri-dockerd

mirantis migrate nodes from dockershim

Voir l'option --cri-containerd

Docker does not implement CRI. If you're going to use Docker you need to also install cri-dockerd to translate cri API to docker API.

Plus Docker (Dockershim) support was removed since 1.24 in K8S

https://kubernetes.io/docs/setup/production-environment/container-runtimes/

Mirantis Container Runtime (MCR) is a commercially available container runtime that was formerly known as Docker Enterprise Edition.

Compraratif https://medium.com/norma-dev/benchmarking-containerd-vs-dockerd-performance-efficiency-and-scalability-64c9043924b1

CRI-O vs Docker https://www.suse.com/c/fr/podman-et-cri-o-le-nouveau-duo-de-la-conteneurisation/ Podman utilise CRI-O

Podman Podman is a daemonless, open source containerization tool used in lab exercises as a replacement for Docker.

Podman implements CRI-O, while Docker implements “CRI”.

Autres

Isolation MicroVM des containers :

  • Kata Container
  • Firecracker

https://blog.octo.com/securite-pods-isolation-runtimeclass

https://blog.stephane-robert.info/docs/conteneurs/moteurs-conteneurs/incus/

https://blog.devops.dev/who-is-the-better-container-runtime-docker-podman-containerd-or-cri-o-034c8eee879b

crun a container runtime written in C (by contrast, runc is written in Go.) firecracker-containerd from AWS, which implements the OCI specification as individual lightweight VMs (and it is also the same technology which powers AWS Lambda) gVisor from Google, which creates containers that have their own kernel. It implements OCI in its runtime called runsc.

krun - crun based OCI runtime using libkrun to run containerized programs in isolated KVM environments

https://vineetcic.medium.com/the-differences-between-docker-containerd-cri-o-and-runc-a93ae4c9fdac

2025/09/17 14:42 · Jean-Baptiste

Notes Kubernetes k8s - sécurite

Ensure Containers Do Not Run As Root

Source : https://www.fairwinds.com/blog/kubernetes-basics-tutorial-ensure-containers-do-not-run-as-root

apiVersion: v1
kind: Pod
metadata:
 name: security-context-demo
spec:
 securityContext:
   runAsNonRoot: true
   runAsUser: 1000
apiVersion: v1
kind: Pod
metadata:
 name: security-context-demo
spec:
 containers:
 - name: busybox
   image: busybox
   securityContext:
     runAsNonRoot: true
     runAsUser: 1000
     # allowPrivilegeEscalation: false
     # privileged: false

If there are no non-root users in the Docker image, you may also need to create one in the Dockerfile, with:

RUN useradd nonroot -u 1000 --user-group
# useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.
Interdire le host namespace

Comment ?

spec:
  hostPID: true
  hostIPC: true
  hostNetwork: true
  volumes:
    - name: host-filesystem
      hostPath:
        path: /
Autres

Source : https://medium.com/@mughal.asim/kubernetes-security-contexts-series-part-3-running-containers-as-non-root-0b7ebd54636c

  • runAsNonRoot: true : Ensures that the container does not run as root. If the image’s default user is root, Kubernetes will refuse to start the pod.
  • runAsUser: 1000 & runAsGroup: 3000 Forces the container to use a specific non-root user (UID 1000) and group (GID 3000).
  • fsGroup: 2000 Ensures that files created in shared volumes have the correct group ownership.
  • Container Security Settings: Setting privileged: false, allowPrivilegeEscalation: false, and dropping all capabilities dramatically limits what processes within the container can do.

spec! runAsUser: 0

securityContext: allowPrivilegeEscalation: true

Utiliser

  • ServiceAccount
  • les RBAC
  • mTLS pour les services
  • EncryptionConfiguration resource pour les servrets (HashiCorp Vault)
  • Sécuriser etcd
  • Don't allow pods that run containers with root
  • SecurtyPolicy (Open Policy Agent / Kyverno)

Utiliser

  • Les NetworkPolicy (par défault tous les noeuds peuvent communiquer avec tous les noeuds Oou ServiceMesh (Side car)

Outils analyse sécu

Voir :

  • m9sweeper
Kube bench

Step 1: Download the official job manifest

Clone the kube-bench repo or grab job.yaml from the GitHub releases page.

git clone https://github.com/aquasecurity/kube-bench.git
cd kube-bench
 
# ou
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml

Step 2: Apply the job to your cluster

kubectl apply -f job.yaml

Step 3: Watch the pod until it shows as Completed

kubectl get pods -w

Step 4: Review the results

#kubectl logs -l job-name=kube-bench
kubectl logs pod/kube-bench-6zgst
podman run --pid=host -v /etc:/etc:ro -v /var:/var:ro -v $(which kubectl):/usr/local/mount-from-host/bin/kubectl -v ~/.kube:/.kube -e KUBECONFIG=/.kube/config -t docker.io/aquasec/kube-bench:latest run 
kubescape

Voir :

Install

kubectl krew update
kubectl krew install kubescape

Scan

kubectl kubescape scan
kubescape scan  --format html --output results.html

Voir Trivy Scan de vulnérabilité pour les images de conteneurs

2025/09/12 16:28 · Jean-Baptiste

Notes - Artifactory - Gestionnaire de dépôt d'objets binaires

upload

curl --fail -u user:'password' --upload-file file.zip 'https:/nexus-repository.claudiosteuernagel.com/repository/my-raw-repo/my-directory/file.zip'

Note : Dans mon cas (avec Artifactory) ça ne marche pas avec l“urlencoding”. Si le mot de passe contient des caractères spéciaux il faut les échapper pour éviter que bash les interprète. Le plus simple étant d'utiliser des guillemets simples.

FIXME

2025/09/10 12:15 · Jean-Baptiste

Notes - git bundle

Transférer une dépôt Git vers une autre machine lorsque les deux machines n'ont pas de connexion directe (AirGap - offline environment)

Voir

We’ll discuss two cases:

Taking a full backup of a repository

Transferring the history of a repository to another machine when the two machines have no direct connection

Exemple de creation de Bundle Git

git bundle create mybundle v1.0.0..master
git bundle create mybundle --since=10.days master
 
git bundle create mybundle --all

Note that --all would not include remote-tracking branches… just like ordinary clone wouldn't either. First clone the repository, and include the --mirror option.

git clone --mirror git@example.org:path/repo.git

Then run

cd /opt/plop
git bundle create repo.bundle --all
git tag -f lastAGbundle master
 
cd /opt/plop
git bundle create ~/toAG/RepoName.bundle lastAGbundle..master --all
git tag -f lastAGbundle master
 
cd /path/to/AG/clone/location
git clone /path/to/AG/bundles/RepoName.bundle -b master
cd RepoName
git gc # Clears some errors 
# Optionally, push to other remotes
 
git bundle verify mybundle

Exemple d'importation de Bundle

[remote "origin"]
    url = /home/me/tmp/file.bundle
    fetch = refs/heads/*:refs/remotes/origin/*
machineB$ cd R2
machineB$ git pull

Autre

$ git bundle list-heads ../commits.bundle
71b84daaf49abed142a373b6e5c59a22dc6560dc refs/heads/master

$ git fetch ../commits.bundle master:other-master
From ../commits.bundle
 * [new branch]      master     -> other-master
git clone --bundle-uri=https://[cdn]/bundle/gitlab-base.bundle 
git clone --bundle-uri=https://[cdn]/bundle/gitlab-base.bundle https://gitlab.com/gitlab-org/gitlab-foss.git g2
2025/09/10 11:03 · Jean-Baptiste
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki