Skip to content

[Question] extra args for minikube oci driver #13892

Closed as not planned
Closed as not planned
@zhan9san

Description

@zhan9san

What Happened?

There are many xxx driver only in minikube start --help.

For docker and podman drivers, could we unified them in one args, like --extra-args, and then pass this args to CreateContainerNode function as below.

runArgs := []string{
"-d", // run the container detached
"-t", // allocate a tty for entrypoint logs
// running containers in a container requires privileged
// NOTE: we could try to replicate this with --cap-add, and use less
// privileges, but this flag also changes some mounts that are necessary
// including some ones docker would otherwise do by default.
// for now this is what we want. in the future we may revisit this.
"--privileged",
"--security-opt", "seccomp=unconfined", // ignore seccomp
"--tmpfs", "/tmp", // various things depend on working /tmp
"--tmpfs", "/run", // systemd wants a writable /run
// logs,pods be stroed on filesystem vs inside container,
// some k8s things want /lib/modules
"-v", "/lib/modules:/lib/modules:ro",
"--hostname", p.Name, // make hostname match container name
"--name", p.Name, // ... and set the container name
"--label", fmt.Sprintf("%s=%s", CreatedByLabelKey, "true"),
// label the node with the cluster ID
"--label", p.ClusterLabel,
// label the node with the role ID
"--label", fmt.Sprintf("%s=%s", nodeRoleLabelKey, p.Role),
// label th enode wuth the node ID
"--label", p.NodeLabel,
}

If we do so, some features can be easier implemented without code change, e.g.

Feature With --extra-args Without --extra-args
Run Minikube container with a static IP --extra-args ip=192.168.10.3 add a parameter like --ip to minikube start
Run Minikube container in a subnet --extra-args subnet=192.168.10.0/30 add a parameter like --subnet to minikube start #12315 #13730 #13766
Expose port in Minikube container --extra-args publish=80:8080 add a parameter like --ports=[] to minikube start
etc TBD add a new parameter

I am not sure extra-args is a better design, and some validations may be lost.

Let me know what you think.

minikube start --help | grep only
      --dns-proxy=false: Enable proxy for NAT DNS requests (virtualbox driver only)
      --download-only=false: If true, only download and cache files for later use - don't install or start anything.
      --extra-disks=0: Number of extra disks created and attached to the minikube VM (currently only implemented for hyperkit and kvm2 drivers)
      --host-dns-resolver=true: Enable host resolver for NAT DNS requests (virtualbox driver only)
      --host-only-cidr='192.168.59.1/24': The CIDR to be used for the minikube VM (virtualbox driver only)
      --host-only-nic-type='virtio': NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)
      --hyperkit-vpnkit-sock='': Location of the VPNKit socket used for networking. If empty, disables Hyperkit VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock (hyperkit driver only)
      --hyperkit-vsock-ports=[]: List of guest VSock ports that should be exposed as sockets on the host (hyperkit driver only)
      --hyperv-external-adapter='': External Adapter on which external switch will be created if no external switch is found. (hyperv driver only)
      --hyperv-use-external-switch=false: Whether to use external switch over Default Switch if virtual switch not explicitly specified. (hyperv driver only)
      --hyperv-virtual-switch='': The hyperv virtual switch name. Defaults to first found. (hyperv driver only)
      --kvm-hidden=false: Hide the hypervisor signature from the guest in minikube (kvm2 driver only)
      --kvm-network='default': The KVM default network name. (kvm2 driver only)
      --kvm-numa-count=1: Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)
      --kvm-qemu-uri='qemu:///system': The KVM QEMU connection URI. (kvm2 driver only)
      --listen-address='': IP Address to use to expose ports (docker and podman driver only)
      --nat-nic-type='virtio': NIC Type used for nat network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)
      --nfs-share=[]: Local folders to share with Guest via NFS mounts (hyperkit driver only)
      --nfs-shares-root='/nfsshares': Where to root the NFS Shares, defaults to /nfsshares (hyperkit driver only)
      --no-kubernetes=false: If set, minikube VM/container will start without starting or configuring Kubernetes. (only works on new clusters)
      --no-vtx-check=false: Disable checking for the availability of hardware virtualization before the vm is started (virtualbox driver only)
      --ports=[]: List of ports that should be exposed (docker and podman driver only)
      --ssh-ip-address='': IP address (ssh driver only)
      --ssh-key='': SSH key (ssh driver only)
      --ssh-port=22: SSH port (ssh driver only)
      --ssh-user='root': SSH user (ssh driver only)
      --uuid='': Provide VM UUID to restore MAC address (hyperkit driver only)
      --vm=false: Filter to use only VM Drivers

Attach the log file

None

Operating System

Other

Driver

Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/proposalproposalslifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.triage/discussItems for discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions