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

calico-ipam replaced to kube-ipam ? #2

Open
ssslkj123 opened this issue Nov 17, 2021 · 2 comments
Open

calico-ipam replaced to kube-ipam ? #2

ssslkj123 opened this issue Nov 17, 2021 · 2 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@ssslkj123
Copy link

Question : Whether it's when I try to use this kube-ipam plugin for fixed my pod IP , my cluster k8s cluster CNI plugin which config and deploy form offical calico-etcd.yaml ,version : v3.19.x .

I try to modify /etc/cni/net.d/10-calico.conflist which created by initContainer : install-cni like :

{
  "name": "k8s-pod-network",
  "cniVersion": "0.3.1",
  "plugins": [
    {
      "type": "calico",
      "log_level": "info",
...
        "ipam": {
                "name": "kube-subnet",
                "type": "kube-ipam",
                "etcdConfig": {
                        "etcdURL": "https://192.168.1.50:2379,https://192.168.1.58:2379,https://192.168.1.63:2379",
			"kubeConfig": "/etc/kubernetes/pki/kubectl.kubeconfig"
                        "etcdCertFile": "/etc/kubernetes/ssl/etcd.pem",
                        "etcdKeyFile": "/etc/kubernetes/ssl/etcd-key.pem",
                        "etcdTrustedCAFileFile": "/etc/kubernetes/ssl/ca.pem"
                },
                "subnet": "10.188.0.0/16",
                "rangeStart": "10.188.0.10",
                "rangeEnd": "10.188.0.200",
                "gateway": "10.188.0.1",
                "routes": [{
                        "dst": "0.0.0.0/0"
                }],
                "resolvConf": "/etc/resolv.conf"
        },
      "policy": {
          "type": "k8s"
      },
      "kubernetes": {
          "kubeconfig": "/etc/cni/net.d/calico-kubeconfig"
      }
    },
...
    {
      "type": "bandwidth",
      "capabilities": {"bandwidth": true}
    }
  ]
}

So if I do this replacement is work or not ? Thanks a lot

@cloudnativer
Copy link
Owner

cloudnativer commented Nov 19, 2021

kube-ipam supports fixing the IP address of pod in calico network. Please see https://github.com/cloudnativer/kube-ipam/blob/main/docs/kubeipam-with-calico.md for details.

In addition, here is an example 10-calico.conflist:


#
# cat /etc/cni/net.d/10-calico.conflist 
{
  "name": "k8s-pod-network",
  "cniVersion": "0.3.1",
  "plugins": [
    {
      "type": "calico",
      "log_level": "info",
      "log_file_path": "/var/log/calico/cni/cni.log",
      "datastore_type": "kubernetes",
      "nodename": "192.168.56.82",
      "mtu": 0,
      "ipam": {
                "name": "kube-subnet",
                "type": "kube-ipam",
                "kubeConfig": "/etc/kubernetes/ssl/kube.kubeconfig",
                "etcdConfig": {
                        "etcdURL": "https://192.168.1.50:2379,https://192.168.1.58:2379,https://192.168.1.63:2379",
                        "etcdCertFile": "/etc/kubernetes/ssl/kubernetes.pem",
                        "etcdKeyFile": "/etc/kubernetes/ssl/kubernetes-key.pem",
                        "etcdTrustedCAFileFile": "/etc/kubernetes/ssl/k8s-root-ca.pem"
                },
                "subnet": "10.244.0.0/16",
                "rangeStart": "10.244.0.10",
                "rangeEnd": "10.244.0.200",
                "gateway": "10.244.0.1",
                "routes": [{
                        "dst": "0.0.0.0/0"
                }],
                "resolvConf": "/etc/resolv.conf"
      },
      "policy": {
          "type": "k8s"
      },
      "kubernetes": {
          "kubeconfig": "/etc/cni/net.d/calico-kubeconfig"
      }
    },
    {
      "type": "portmap",
      "snat": true,
      "capabilities": {"portMappings": true}
    },
    {
      "type": "bandwidth",
      "capabilities": {"bandwidth": true}
    }
  ]
}

#
#

@cloudnativer
Copy link
Owner

cloudnativer commented Nov 19, 2021

So if I do this replacement is work or not ? Thanks a lot

yes, you can see https://github.com/cloudnativer/kube-ipam/blob/main/docs/kubeipam-with-calico.md for details.

There is an example calico.yaml in the yaml directory. Please note the settings of kubeConfig, etcdConfig, subnet and other parameters. subnet and CALICO_IPV4POOL_CIDR parameters should be set to the same value.

@cloudnativer cloudnativer self-assigned this Nov 19, 2021
@cloudnativer cloudnativer added help wanted Extra attention is needed question Further information is requested labels Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants