打赏

Rancher

1.安装

 sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable

 // 启用外部数据库
 sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server \
    --db-host myhost.example.com --db-port 3306 --db-user username --db-pass password --db-name cattle

  // 挂载数据卷
  sudo docker run -d -v <host_vol>:/var/lib/mysql --restart=unless-stopped -p 8080:8080 rancher/server

 // 查看容器日志
 sudo docker logs -f <CONTAINER_ID>

 // UI 访问
  http://127.0.0.1:8080

2.创建集群
集群 -- 添加集群 -- 集群名称 --下一步 -- 勾选 Etcd Control Worker -- 复制命令 -- 在master运行

docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.4.3 --server https://10.7.xx \
--token zrbck9vcsgcl48dxrdxzrhnlbbfgzmkxxxx2544lgvjbk842rghzw --ca-checksum d9a08211ed0b54f9a7xxxx7efc11d7e4ec0b21dc99e7a4a054a04d04915aaa --etcd --controlplane --worker --node-name lowercase-hostname

yaml文件内容:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gitlab-runner
  namespace: gitlab
spec:
  replicas: 1
  selector:
    matchLabels:
      name: gitlab-runner
  template:
    metadata:
      labels:
        name: gitlab-runner
    spec:
      containers:
      - args:
        - run
        image: gitlab/gitlab-runner:latest
        imagePullPolicy: Always
        name: gitlab-runner
        volumeMounts:
        - mountPath: /etc/ssl/certs
          name: cacerts
          readOnly: true
      restartPolicy: Always
      volumes:
      - hostPath:
          path: /usr/share/ca-certificates/mozilla
        name: cacerts

pod命令行:

gitlab-ci-multi-runner register
gitlab-ci-multi-runner start

gitlab-rancher部署
https://tyyzqmf.github.io/2018/11/08/Kubernetes部署gitlab-runner/
https://www.jevic.cn/2018/02/06/gitlab-cicd-rancher-build/#查看项目状态

相关链接

https://rancher.com/docs/rancher/v1.6/zh/installing-rancher/installing-server/
https://www.hi-linux.com/posts/20438.html
https://blog.51cto.com/13620944/2465867

posted @ 2020-05-22 13:31  苍山落暮  阅读(252)  评论(0编辑  收藏  举报