Kubespray安装记录

安装 nginx 的 docker-compose 服务记录:

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
mkdir ~/distribution
vi ~/distribution/docker-compose.yml
 #  distribute
 version: '2'
 services:
     distribute:
         image: nginx:1.15.12
         volumes:
             - ./conf.d:/etc/nginx/conf.d
             - ./distributedfiles:/usr/share/nginx/html
         network_mode: "host"
        container_name: nginx_distribute
:wq
mkdir ~/distribution/distributedfiles
mkdir ~/distribution/
mkdir ~/distribution/conf.d
vi ~/distribution/conf.d/open_distribute.conf
#输入以下内容
#open_distribute.conf

server {
    #server_name distribute.search.leju.com;
        listen 60000;

    root /usr/share/nginx/html;

    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Headers X-Requested-With;
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

    location / {
    #    index index.html;
                autoindex on;
    }
    expires off;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|eot|ttf|woff|woff2|svg)$ {
        expires -1;
    }

    location ~ .*\.(js|css)?$ {
        expires -1 ;
    }
} # end of public static files domain : [ distribute.search.leju.com ]
#启动
docker-compose up -d

启动后上传文件到 distribution

1
scp -r contrib/offline/temp/files/ root@10.0.37.129:/root/distribution/distributedfiles/

接下来关闭 selinux

1
2
vi /etc/selinux/config
修改为SELINUX=disabled

禁用后重启。

firewalld 关闭

1
2
systemctl stop firewalld
systemctl disable firewalld

第二部进行安装

1
sudo ansible-playbook -i inventory/mycluster/inventory.ini --private-key /root/.ssh/id_rsa cluster.yml -b -v

参考文档:

https://blog.k8s.li/deploy-k8s-by-kubespray.html

安装完成后:

kubectl get nodes ,如果得到 not ready 的时候,可以重启集群即可。

配置 containerd 配置文件

 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
31
32
33
34
35
36
37
38
39
40
41
[root@k8s-single ~]# cat /etc/containerd/config.toml
version = 2
root = "/var/lib/containerd"
state = "/run/containerd"
oom_score = 0

[grpc]
  max_recv_message_size = 16777216
  max_send_message_size = 16777216

[debug]
  level = "info"

[metrics]
  address = ""
  grpc_histogram = false

[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
    sandbox_image = "10.0.37.153:5000/pause:3.6"
    max_container_log_line_size = -1
    [plugins."io.containerd.grpc.v1.cri".containerd]
      default_runtime_name = "runc"
      snapshotter = "overlayfs"
      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
          runtime_type = "io.containerd.runc.v2"
          runtime_engine = ""
          runtime_root = ""
          [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
            systemdCgroup = true
              [plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = ["https://registry-1.docker.io"]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."10.0.37.153:5000"]
          endpoint = ["http://10.0.37.153:5000"]



[root@k8s-single ~]#

参考文档:containerd 配置 http 私服

1
https://www.jianshu.com/p/90a0c85d263d

升级 ansible

1
python3 -m pip install --upgrade --user ansible -i https://pypi.tuna.tsinghua.edu.cn/simple
Licensed under CC BY-NC-SA 4.0
最后更新于 Jan 06, 2025 05:52 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up