美文网首页
kubespray不翻墙安装

kubespray不翻墙安装

作者: 博楠同学 | 来源:发表于2022-01-25 13:33 被阅读0次

    Kubespray 是 Kubernetes incubator 中的项目,目标是提供 Production Ready Kubernetes 部署方案,该项目基础是通过 Ansible Playbook 来定义系统与 Kubernetes 集群部署的任务。

    1、安装基础环境

    yum install -y python-pip git sshpass
    2、拉取官方代码

    kubespray官方github地址

    git clone https://github.com/kubernetes-sigs/kubespray

    cd kubespray && sudo pip install -r requirements.txt
    cp -rfp inventory/sample inventory/mycluster
    3、修改镜像源为阿里源

    vim inventory/mycluster/group_vars/k8s-cluster/k8s-cluster.yml
    kube_image_repo: "registry.aliyuncs.com/google_containers"
    4、修改基础镜像

    vim roles/download/defaults/main.yml
    kube_image_repo: "registry.aliyuncs.com/google_containers" --修改了上面的文件可不用修改此处
    pod_infra_image_repo: "registry.aliyuncs.com/google_containers/pause-{{ image_arch }}" --pause-adm64:3.1
    dashboard_image_repo: "registry.aliyuncs.com/google_containers/kubernetes-dashboard-{{ image_arch }}"

    如果需要修改网络插件,可以修改下面的参数 (cilium, calico, contiv, weave or flannel)
    kube_network_plugin: calico
    5、搭建

    ansible-playbook -i inventory/mycluster/hosts.ini --become --become-user=root cluster.yml
    6、重置

    ansible-playbook -i inventory/mycluster/hosts.ini --become --become-user=root reset.yml
    7、修改集群基础配置

    vim inventory/mycluster/group_vars/k8s-cluster/k8s-cluster.yml
    kube_proxy_mode: ipvs --proxy_mode:ipvs,iptables
    kube_network_plugin: flannel --network_plugin:cilium, calico, contiv, weave or flannel
    dns_mode: coredns --dns: dnsmasq_kubedns, kubedns, coredns, coredns_dual, manual or none
    8、启用ingress-nginx插件

    vim inventory/mycluster/group_vars/k8s-cluster/addons.yml
    ingress_nginx_enabled: false --开启nginx-ingress-controller 插件

    相关文章

      网友评论

          本文标题:kubespray不翻墙安装

          本文链接:https://www.haomeiwen.com/subject/fwewhrtx.html