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上面的配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 需要添加地址池

1
2
3
4
5
6
7
8
9
10
11
12
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

 

1
2
3
4
5
6
7
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上面创建

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 @   haha1680737  阅读(849)  评论(0编辑  收藏  举报
编辑推荐:
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
阅读排行:
· 从零开始开发一个 MCP Server!
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时
· Browser-use 详细介绍&使用文档
点击右上角即可分享
微信分享提示