k8s-calico

1 按照官方指导文档安装

https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/integration

注意事项:

1.1 master需要配置环境变量

ETCD_ENDPOINTS=http://192.168.56.110:2379
1.2 node上面的配置文件
ubuntu@k8s-node:~$ cat /etc/cni/net.d/10-calico.conf
{
    "name": "calico-k8s-network",
    "cniVersion": "0.1.0",
    "type": "calico",
    "etcd_endpoints": "http://192.168.56.110:2379",
    "log_level": "info",
    "ipam": {
        "type": "calico-ipam",
        "assign_ipv4": "true",
        "ipv4_pools": ["10.1.0.0/16"]
    },
    "policy": {
        "type": "k8s"
    },
    "kubernetes": {
        "kubeconfig": "/var/lib/kubelet/kubeconfig"
    }
}

  1.3 需要添加地址池

ubuntu@k8s-master:~$ cat ippool.yaml
apiVersion: v1
kind: ipPool
metadata:
  cidr: "10.1.0.0/16"
spec:
  ipip:
    enabled: true
    mode: cross-subnet
  nat-outgoing: true
  disabled: false
ubuntu@k8s-master:~$ calicoctl apply -f ippool.yaml

  

 1.4 修改kubelet的配置,使其使用calico

 

ubuntu@k8s-node:~$ sudo cat /etc/kubernetes/kubelet
#KUBELET_ADDRESS="--address=127.0.0.1"
KUBELET_HOSTNAME="--hostname-override=192.168.56.111"
#KUBELET_API_SERVER="--api-servers=http://192.168.56.110:8080"
# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS="--enable-server=true --enable-debugging-handlers=true --fail-swap-on=false --kubeconfig=/var/lib/kubelet/kubeconfig --network-plugin=cni  --cni-conf-dir=/etc/cni/net.d  --cni-bin-dir=/opt/cni/bin"

 1.5 calico-kube-controller 容器,需要在master上面创建

ubuntu@k8s-master:~$ cat a
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: calico-policy-controller
  namespace: kube-system
  labels:
    k8s-app: calico-policy
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      name: calico-policy-controller
      namespace: kube-system
      labels:
        k8s-app: calico-policy
    spec:
      hostNetwork: true
      containers:
        - name: calico-policy-controller
          image: quay.io/calico/kube-policy-controller:v0.7.0
          env:
            - name: ETCD_ENDPOINTS
              value: "http://192.168.56.110:2379"
            - name: K8S_API
              value: "https://kubernetes.default:443"
            - name: CONFIGURE_ETC_HOSTS
              value: "true"

  

 

  

 
posted @ 2017-12-28 14:28  haha1680737  阅读(848)  评论(0编辑  收藏  举报