Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to config dhcp ipam plugin #1090

Open
13567436138 opened this issue Sep 5, 2024 · 2 comments
Open

how to config dhcp ipam plugin #1090

13567436138 opened this issue Sep 5, 2024 · 2 comments

Comments

@13567436138
Copy link

cat <<EOF | kubectl apply -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: dhcp-net
spec:
  config: '{
    "cniVersion": "0.3.1",
    "type": "macvlan",
    "master": "ens33",
    "mode": "bridge",
    "ipam": {
        "type": "dhcp",
        "daemonSocketPath": "/run/cni/dhcp.sock",
        "request": [
            {
                "skipDefault": false
            }
        ],
        "provide": [
            {
                "option": "subnet-mask",
                "value": "192.168.1.1/24"
            }
        ]
    }
  }'
EOF

Warning FailedCreatePodSandBox 3m19s (x136 over 17m) kubelet (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "e162a982e4cf574daa9544100e5466ebdd7939b1d0470437e2d91b6411a402f3": plugin type="multus-shim" name="multus-cni-network" failed (add): CmdAdd (shim): CNI request failed with status 400: 'ContainerID:"e162a982e4cf574daa9544100e5466ebdd7939b1d0470437e2d91b6411a402f3" Netns:"/var/run/netns/cni-60d1a714-9279-2e14-7c7f-bd8d780b9ff3" IfName:"eth0" Args:"IgnoreUnknown=1;K8S_POD_NAMESPACE=default;K8S_POD_NAME=samplepod;K8S_POD_INFRA_CONTAINER_ID=e162a982e4cf574daa9544100e5466ebdd7939b1d0470437e2d91b6411a402f3;K8S_POD_UID=36e51649-5257-43ce-b51a-13231cede974" Path:"" ERRORED: error configuring pod [default/samplepod] networking: [default/samplepod/36e51649-5257-43ce-b51a-13231cede974:dhcp-net]: error adding container to network "dhcp-net": error calling DHCP.Allocate: Can not parse option "": Can not parse option: strconv.ParseUint: parsing "": invalid syntax
': StdinData: {"capabilities":{"bandwidth":true,"portMappings":true},"clusterNetwork":"/host/etc/cni/net.d/10-calico.conflist","cniVersion":"0.3.1","logLevel":"verbose","logToStderr":true,"name":"multus-cni-network","type":"multus-shim"}

@lisongmin
Copy link
Contributor

The option must set in each request, so you may remove the

            {
                "skipDefault": false
            }

Or add an option to it.

@13567436138
Copy link
Author

How to add option to it
Can you give full example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants