概述
本文主要提供如何在一个 Kubernetes 环境的容器集群中构建 yum 源仓库。
1
2
3
4
5
6
7
8
9
10
|
yum --disablerepo=* --enablerepo=sre install nvidia-docker2 -y
cat >> /etc/yum.repos.d/sre.repo <<EOF
[sre]
name=sre yum repos
baseurl=http://yum-with-browser-v1:8080
enable=1
gpgcheck=0
EOF
yum --disablerepo=* --enablerepo=sre install nvidia-docker2 -y
|
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
yum --disablerepo=* --enablerepo=sre makecache
yum --disablerepo=* --enablerepo=sre update
yum --disablerepo=* --enablerepo=sre list available
yum --disablerepo=* --enablerepo=sre search nvidia
yum --disablerepo=\* --enablerepo=docker-ce-stable search docker
yum --disablerepo=* --enablerepo=sre install nvidia-docker2
yum --disablerepo=* --enablerepo=sre downgrade libselinux
yum search docker
createrepo -po --no-database /application/yum/centos7/x86_64/
createrepo --update /application/yum/centos7/x86_64/
createrepo -pdo /tmp/yum/centos7/x86_64/ /application/yum/centos7/x86_64/
docker run -it --rm \
--device /dev/fuse \
--cap-add SYS_ADMIN \
--security-opt "apparmor=unconfined" \
--env "AWS_S3_BUCKET=<bucketName>" \
--env "AWS_S3_ACCESS_KEY_ID=<accessKey>" \
--env "AWS_S3_SECRET_ACCESS_KEY=<secretKey>" \
--env UID=$(id -u) \
--env GID=$(id -g) \
-v /mnt/tmp:/opt/s3fs/bucket:rshared \
efrecon/s3fs
docker run -it --rm --privileged \
--security-opt "apparmor=unconfined" \
--env "AWS_S3_BUCKET=k8s-yum" \
--env "AWS_S3_URL=http://10.16.24.13:7480" \
--env "AWS_S3_ACCESS_KEY_ID=POAD02AAO9X1N0FBIHGO" \
--env "AWS_S3_SECRET_ACCESS_KEY=zLlT0WWSwgOITZ3xGgVA5nLSpHAfmALAVHNoHJ08" \
--env "S3FS_DEBUG=1" \
--env "S3FS_ARGS=-o use_path_request_style" \
--env UID=$(id -u) \
--env GID=$(id -g) \
harbor.fql.com/middleware/s3fs
docker run -it --rm \
--device /dev/fuse \
--net=host \
--cap-add SYS_ADMIN \
--security-opt "apparmor=unconfined" \
--env "AWS_S3_BUCKET=k8s-yum" \
--env "AWS_S3_URL=http://10.16.24.13:7480" \
--env "AWS_S3_ACCESS_KEY_ID=POAD02AAO9X1N0FBIHGO" \
--env "AWS_S3_SECRET_ACCESS_KEY=zLlT0WWSwgOITZ3xGgVA5nLSpHAfmALAVHNoHJ08" \
--env "S3FS_DEBUG=1" \
--env "S3FS_ARGS=-o use_path_request_style" \
--env UID=$(id -u) \
--env GID=$(id -g) \
-v /mnt/tmp:/opt/s3fs/bucket:rshared \
harbor.fql.com/middleware/s3fs
# 成功
s3fs -o logfile=/tmp/s3fs.log -o bucket=k8s-yum -o passwd_file=~/.passwd-s3fs -o url="http://10.16.24.13:7480/" -o ssl_verify_hostname=0 -o nosscache -o dbglevel=dbg -o use_path_request_style /new
access_key = POAD02AAO9X1N0FBIHGO
secret_key = zLlT0WWSwgOITZ3xGgVA5nLSpHAfmALAVHNoHJ08
host_base = http://10.16.24.13:7480
host_bucket = k8s-yum
use_https = False
echo POAD02AAO9X1N0FBIHGO:zLlT0WWSwgOITZ3xGgVA5nLSpHAfmALAVHNoHJ08 > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
mkdir /new
s3fs k8s-yum /new -o passwd_file=~/.passwd-s3fs -o url="http://10.16.24.13:7480/"
s3fs -o logfile=/tmp/s3fs.log k8s-yum /new -o passwd_file=~/.passwd-s3fs -o url="http://10.16.24.13:7480/"
s3fs -o logfile=/tmp/s3fs.log -o bucket=k8s-yum -o passwd_file=~/.passwd-s3fs -o url="http://xsky4.storage.fql.com:8060/" -o ssl_verify_hostname=0 -o nosscache -o dbglevel=dbg /new
docker run -it --rm \
--device /dev/fuse \
--cap-add SYS_ADMIN \
--security-opt "apparmor=unconfined" \
--env "AWS_S3_BUCKET=<bucketName>" \
--env "AWS_S3_ACCESS_KEY_ID=<accessKey>" \
--env "AWS_S3_SECRET_ACCESS_KEY=<secretKey>" \
--env UID=$(id -u) \
--env GID=$(id -g) \
-v /mnt/tmp:/opt/s3fs/bucket:rshared \
efrecon/s3fs
|
文件管理器
1
2
3
|
docker pull filebrowser/filebrowser
docker tag filebrowser/filebrowser harbor.dev-prev.com/middleware/filebrowser
docker push harbor.dev-prev.com/middleware/filebrowser
|
警告
本文最后更新于 2017年2月1日,文中内容可能已过时,请谨慎参考。