首页 > 编程知识 正文

RKE安装的集群后有UI界面嘛,rke部署

时间:2023-05-06 03:36:38 阅读:273084 作者:271

使用RKE部署kubernetes集群 一、基本环境准备 1.1 环境准备一

这里个人觉得可以和kubeadm的步骤一致,不过还是按照1.2配置的官方要求

1、关闭防火墙

systemctl stop firewalld && systemctl disable firewalld

2、为iptables设置空规则

yum -y install iptables-services && systemctl start iptables && systemctl enable iptables&& iptables -F && service iptables save

3、关闭SELINUX

swapoff -a && sed -i '/ swap / s/^(.*)$/#1/g' /etc/fstabsetenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config 1.2 官方提供

1、创建一个新用户(之后将用来运行docker,尽量不要用root用户)

useradd lurious

2、将新创建的用户加入到docker组中,为了可以运行docker

usermod -aG docker lurious

3、关闭swap 分区

swapoff -a

4、执行以下的脚本

for module in br_netfilter ip6_udp_tunnel ip_set ip_set_hash_ip ip_set_hash_net iptable_filter iptable_nat iptable_mangle iptable_raw nf_conntrack_netlink nf_conntrack nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat nf_nat_ipv4 nf_nat_masquerade_ipv4 nfnetlink udp_tunnel veth vxlan x_tables xt_addrtype xt_conntrack xt_comment xt_mark xt_multiport xt_nat xt_recent xt_set xt_statistic xt_tcpudp; do if ! lsmod | grep -q $module; then echo "module $module is not present"; fi; done

5、更改sysctl设置

vi /etc/sysctl.conf net.ipv4.ip_forward = 1net.bridge.bridge-nf-call-ip6tables = 1# 官方中要求的net.bridge.bridge-nf-call-iptables = 1

6、开启6443端口(使用iptables)

以下语句执行一个就可以

# Open TCP/6443 for alliptables -A INPUT -p tcp --dport 6443 -j ACCEPT# Open TCP/6443 for one specific IPiptables -A INPUT -p tcp -s your_ip_here --dport 6443 -j ACCEPT

7、开启6443端口(使用firewalld)

# Open TCP/6443 for allfirewall-cmd --zone=public --add-port=6443/tcp --permanentfirewall-cmd --reload# Open TCP/6443 for one specific IPfirewall-cmd --permanent --zone=public --add-rich-rule=' rule family="ipv4" source address="your_ip_here/32" port protocol="tcp" port="6443" accept'firewall-cmd --reload

8、允许TCP

AllowTcpForwarding yes

9、设置SSH(在RKE所在的宿主机上执行)

一路空格就行

ssh-keygen

10、将所生成的密钥的公钥分发到各个节点

ssh-copy-id lurious@192.168.109.10ssh-copy-id lurious@192.168.109.11ssh-copy-id lurious@192.168.109.12 二、使用RKE(Rancher kubernetes engine)部署Kubernetes 2.1、查看版本 ./rke version 2.2 、rke配置文件 # If you intened to deploy Kubernetes in an air-gapped environment,# please consult the documentation on how to configure custom RKE images.# 配置harbor仓库信息private_registries: - url: harbor.lurious.com:8443 user: admin password: "********"nodes:# 节点ip地址- address: 192.168.109.10# 远程连接的端口 port: "22"# 主机间的通信地址 internal_address: ""# 该节点 配制的角色,这里赋予三种角色。 role: - controlplane - worker - etcd# 节点名称 hostname_override: newer1# 远程连接的用户 user: lurious# docker socket 的配置 默认为 /var/run/docker.sock docker_socket: /var/run/docker.sock ssh_key: ""# ssh的密钥地址,即 最开始 配置 ssh-keygen 和 ssh-copy-id 两个命令配置的 ssh_key_path: ~/.ssh/id_rsa# ssh 的证书 这里没有配置私钥 空着就可以 ssh_cert: "" ssh_cert_path: ""# 节点的 labels labels: {}# 给节点设置污点,做调度策略用 taints: []- address: 192.168.109.11 port: "22" internal_address: "" role: - controlplane - worker - etcd hostname_override: newer2 user: lurious docker_socket: /var/run/docker.sock ssh_key: "" ssh_key_path: ~/.ssh/id_rsa ssh_cert: "" ssh_cert_path: "" labels: {} taints: []services: etcd: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: [] external_urls: [] ca_cert: "" cert: "" key: "" path: "" uid: 0 gid: 0 snapshot: null retention: "" creation: "" backup_config: null kube-api: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: []# 在kubernetes上创建任何服务的ip范围# 必须和 kube-controller 的地址范围保持一致 service_cluster_ip_range: 10.43.0.0/16# 暴露在集群外的 NodePort 的端口范围 如30000-32767 service_node_port_range: "" pod_security_policy: false# docker镜像拉去策略 always_pull_images: false secrets_encryption_config: null audit_log: null admission_configuration: null event_rate_limit: null kube-controller: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: [] cluster_cidr: 10.42.0.0/16 service_cluster_ip_range: 10.43.0.0/16 scheduler: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: [] kubelet: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: [] cluster_domain: cluster.local infra_container_image: "" cluster_dns_server: 10.43.0.10 fail_swap_on: false generate_serving_certificate: false kubeproxy: image: "" extra_args: {} extra_binds: [] extra_env: [] win_extra_args: {} win_extra_binds: [] win_extra_env: []# 使用的网络插件 这里默认为 flannel插件network: plugin: flannel options: {} mtu: 0 node_selector: {} update_strategy: nullauthentication: strategy: x509 sans: [] webhook: nulladdons: ""addons_include: []system_images: etcd: rancher/coreos-etcd:v3.4.13-rancher1 alpine: rancher/rke-tools:v0.1.65 nginx_proxy: rancher/rke-tools:v0.1.65 cert_downloader: rancher/rke-tools:v0.1.65 kubernetes_services_sidecar: rancher/rke-tools:v0.1.65 kubedns: rancher/k8s-dns-kube-dns:1.15.10 dnsmasq: rancher/k8s-dns-dnsmasq-nanny:1.15.10 kubedns_sidecar: rancher/k8s-dns-sidecar:1.15.10 kubedns_autoscaler: rancher/cluster-proportional-autoscaler:1.8.1 coredns: rancher/coredns-coredns:1.7.0 coredns_autoscaler: rancher/cluster-proportional-autoscaler:1.8.1 nodelocal: rancher/k8s-dns-node-cache:1.15.13 kubernetes: rancher/hyperkube:v1.19.3-rancher1 flannel: rancher/coreos-flannel:v0.13.0-rancher1 flannel_cni: rancher/flannel-cni:v0.3.0-rancher6 calico_node: rancher/calico-node:v3.16.1 calico_cni: rancher/calico-cni:v3.16.1 calico_controllers: rancher/calico-kube-controllers:v3.16.1 calico_ctl: rancher/calico-ctl:v3.16.1 calico_flexvol: rancher/calico-pod2daemon-flexvol:v3.16.1 canal_node: rancher/calico-node:v3.16.1 canal_cni: rancher/calico-cni:v3.16.1 canal_controllers: rancher/calico-kube-controllers:v3.16.1 canal_flannel: rancher/coreos-flannel:v0.13.0-rancher1 canal_flexvol: rancher/calico-pod2daemon-flexvol:v3.16.1 weave_node: weaveworks/weave-kube:2.7.0 weave_cni: weaveworks/weave-npc:2.7.0 pod_infra_container: rancher/pause:3.2 ingress: rancher/nginx-ingress-controller:nginx-0.35.0-rancher1 ingress_backend: rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1 metrics_server: rancher/metrics-server:v0.3.6 windows_pod_infra_container: rancher/kubelet-pause:v0.1.4ssh_key_path: ~/.ssh/id_rsassh_cert_path: ""ssh_agent_auth: false# 开启rbac认证策略authorization: mode: rbac options: {}ignore_docker_version: nullkubernetes_version: ""private_registries: []ingress: provider: "" options: {} node_selector: {} extra_args: {} dns_policy: "" extra_envs: [] extra_volumes: [] extra_volume_mounts: [] update_strategy: null# 集群名称cluster_name: "cluster-newer"# 云服务提供商cloud_provider: name: ""prefix_path: ""win_prefix_path: ""addon_job_timeout: 0bastion_host: address: "" port: "" user: "" ssh_key: "" ssh_key_path: "" ssh_cert: "" ssh_cert_path: ""monitoring: provider: "" options: {} node_selector: {} update_strategy: null replicas: nullrestore: restore: false snapshot_name: ""dns: null 2.3、开始安装 ./rke up

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。