kubeasz deploys k8s cluster

Environment preparation Master node Copy 1 2 3 172.16.244.14 172.16.244.16 172.16.244.18 Node node Copy 1 2 172.16.244.25 172.16.244.27 Master node VIP address: 172.16.243.13 Deployment tool: Ansible/kubeasz Initialize the environment Install Ansible Copy 1 2 3 4 5 apt update apt-get install ansible expect git clone https://github.com/easzlab/kubeasz cd kubeasz cp * /etc/ansible/ Configure ansible for password-free login Copy 1 2 ssh-keygen -t rsa -b 2048 #Generate key ./tools/yc-ssh-key-copy.sh hosts root 'rootpassword'

Deploy gitlab-runner based on K8S

Deploy gitlab-runner Here is based on helm deployment, reference: https://gitlab.com/gitlab-org/charts/gitlab-runner.git Copy 1 helm install --namespace gitlab-managed-apps --name k8s-gitlab-runner -f values.yaml Note: the values.yaml file needs to be set to privileged: true Build a basic image (docker in docker) Dockerfile file content: Copy 1 2 3 4 5 6 7 FROM docker:19.03.1-dind WORKDIR /opt RUN echo "nameserver 114.114.114.114" >> /etc/resolv.conf RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN apk update RUN apk upgrade

Building Jenkins based on Docker-compose

docker-compose configuration Copy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 version: '2' services: jenkins: image: jenkins/jenkins:latest restart: always environment: JAVA_OPTS: "-Dorg.apache.commons.jelly.tags.fmt.timeZone=Asia/Shanghai -Djava.awt.headless=true -Dmail.smtp.starttls.enable=true" ports: - "80:8080" - "50000:50000" volumes: - '/ssd/jenkins:/var/jenkins_home' - '/var/run/docker.sock:/var/run/docker.sock' - '/etc/localtime:/etc/localtime:ro' dns: 223.5.5.5 networks: - extnetwork networks: extnetwork: ipam: config: - subnet: 172.255.0.0/16 Start the service Copy 1 docker-compose up

MacPro configuration cool terminal (oh my zsh)

brew tool Official website: https://brew.sh Install brew Copy 1 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Change the brew source to the domestic source Copy 1 2 3 4 5 6 7 git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles #Append to ~/.zshrc brew update #Update homebrew brew upgrade #Upgrade all installed

Summary of Git daily commands

Git global settings: Copy 1 2 git config --global user.name "wanzi" git config --global user.email "iwz2099@163.com" Git commit code Copy 1 2 3 4 5 6 7 8 9 10 11 12 13 git clone git@github.com:iwz2099/test.git cd test touch README.md git add README.md git commit -m "add README" git push -u origin master #The above command pushes the local master branch to the remote origin branch. At the same time,

Dockerfile multi-stage build

Understanding of Docker multi-stage build: Building an image requires a base image, and subsequent operations will be built based on the base image There is a layered concept in the docker image file. Each time the RUN instruction is executed, the image will have one more layer, so the image size can be reduced by reducing the layers When there are multiple froms, only the image of the last from

Dockerfile syntax details

FROM Specify the base image used to build the image. FROM must be the first instruction in the non-comment line in the Dockerfile. If there is no specified image locally, it will automatically pull the image from the Docker public library. Example: Copy 1 FROM ubuntu:14.04 #Inherit ubuntu:14.04 MAINTAINER Specify creator information Copy 1 MAINTAINER wanzi "iwz2099@163.com" ENV Set environment variables, which will be used by subsequent RUN instructions and

Docker Basic Commands

Common commands Copy 1 2 3 4 5 6 7 8 docker info #View local docker information docker search openresty #Search for remote image warehouse docker images #View the current system image warehouse image docker ps #View the currently running container docker pull centos #Get the remote image, the default tag is not specified, which is the latest docker container run -p 8000:80 --rm -t -i centos:latest /bin/bash #-p maps