Monday, September 20, 2021

Some Docker run arguments mapping to Kubernetes YAML


Some Docker run arguments mapping to Kubernetes YAML
For instance: 

docker run -ti --rm -v /lib/modules:/lib/modules --net=host --pid=host --privileged \ ubuntu:18.04 bash 

Mapping Table:

DockerKubernetes (YAML)
--add-host
--add-host   host1:192.168.100.31
 
apiVersion: v1
kind: Pod
metadata:
  name: xxxx
spec:
hostAliases:
  - ip:   "192.168.100.31"
    hostnames:
    - "host1"
--privileged
 
apiVersion:   policy/v1beta1
kind:   PodSecurityPolicy
metadata:
  name: xxxx
spec:
  privileged: true
-v  /var/run/docker.sock:/var/run/docker.sock
 
…   spec:
  containers:
  - name: xxxx
      image: xxxxx
    volumeMounts:
    - name: dockersock
        mountPath: "/var/run/docker.sock"
  volumes:
  - name: dockersock
    hostPath:
      path:   /var/run/docker.sock 
--pid=host
 
(pid namespace)
  template:
      spec:
       hostPID: true
--net=host

(network namespace)
  template:
      spec:
     hostNetwork: true

 

No comments: