跳至内容

博客

Kubernetes All-in-One环境安装

Kubernetes安装及初始化 研发环境搭建Kubernetes All-in-One环境搭建。 CentOS 7初始化 ## Set SELinux in permissive mode (effectively disabling it) setenforce 0 ##sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config systemctl stop NetworkManager systemctl disable NetworkManager systemctl status firewalld systemctl stop firewalld systemctl disable firewalld systemctl status firewalld firewall-cmd --state curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all && yum makecache yum update -y Docker国内源安装 ## Install Docker curl -sSL https://get.daocloud.io/docker | sh -s -- "--mirror" "Aliyun" ## Replace docker repo mkdir -p /etc/docker cat > /etc/docker/daemon.json <<EOF { "registry-mirrors": ["https://6m7d428u.mirror.aliyuncs.com"], "dns": ["114.114.114.114"], "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ] } EOF systemctl enable docker && systemctl daemon-reload && systemctl restart docker curl -L https://get.daocloud.io/docker/compose/releases/download/1.28.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose 安装Kubernetes软件 ## step1 Installation Process cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg exclude=kube* EOF yum install -y kubelet-1.18.0 kubeadm-1.18.0 kubectl-1.18.0 --disableexcludes=kubernetes systemctl enable kubelet ## for CentOS 7 cat <<EOF > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 vm.swappiness=0 EOF sysctl --system ## from k8s 1.8, swap need to be cloased, otherwise k8s could not be started ## swapoff -a ## Modify /etc/fstab, comment swap mount 初始化Kubernetes集群 ## Step2 initialization ## Specify kubernetes-version if mirror do not contain latest kubernetes container. ex: if kubeadm is version 1.18.5, you can only ## install kubernetes = 1.18.x kubeadm init --pod-network-cidr=10.244.0.0/16 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=1.18.0 ## Response from output ## You should now deploy a pod network to the cluster. ## Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: ## https://kubernetes.io/docs/concepts/cluster-administration/addons/ ## Then you can join any number of worker nodes by running the following on each as root: ## kubeadm join 192.168.10.111:6443 --token 1odaru.0by05advhbu7edgt \ ## --discovery-token-ca-cert-hash sha256:3efb71c40cce36c5ed90fc8b5831233aba06eec26576088e8e7a7a892d272776 ## Step3 To use cluster mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config ## Step4 flannel Network sysctl net.bridge.bridge-nf-call-iptables=1 kubectl apply -f https://gitee.com/xiaoquqi/flannel/raw/master/Documentation/kube-flannel.yml 允许Master节点运行Pods kubectl taint nodes --all node-role.kubernetes.io/master- 测试 安装Wordpress和MySQL curl -LO https://raw.githubusercontent.com/xiaoquqi/k8s_demo/master/wordpress/mysql-deployment.yaml curl -LO https://raw.githubusercontent.com/xiaoquqi/k8s_demo/master/wordpress/wordpress-deployment.yaml curl -LO https://raw.githubusercontent.com/xiaoquqi/k8s_demo/master/wordpress/kustomization.yaml 执行安装 kubectl apply -k ./ 验证 kubectl get secrets kubectl get pvc kubectl get pods kubectl get services wordpress 资源清理 kubectl delete -k ./

更多 →

2020-07-31

CentOS 7和Docker初始化安装

CentOS 7初始化 该安装脚本为搭建研发环境常用的脚本,记录在Blog中便于查阅。 ## Set SELinux in permissive mode (effectively disabling it) setenforce 0 ##sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config systemctl stop NetworkManager systemctl disable NetworkManager systemctl status firewalld systemctl stop firewalld systemctl disable firewalld systemctl status firewalld firewall-cmd --state curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all && yum makecache yum update -y Docker国内源安装 ## Install Docker curl -sSL https://get.daocloud.io/docker | sh -s -- "--mirror" "Aliyun" ## Replace docker repo mkdir -p /etc/docker cat > /etc/docker/daemon.json <<EOF { "registry-mirrors": ["https://6m7d428u.mirror.aliyuncs.com"], "dns": ["114.114.114.114"], "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ] } EOF systemctl enable docker && systemctl daemon-reload && systemctl restart docker curl -L https://get.daocloud.io/docker/compose/releases/download/1.28.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

更多 →

2020-07-31

[阿里云]使用DataQuotient 画像分析筛选优质基金

该教程是阿里云帮助文档一部分,这里做了进一步完善:https://help.aliyun.com/document_detail/160711.html?spm=a2c4g.11174283.6.603.682fa00bJ7AHYK

更多 →

2020-04-14

[Python]利用ZooKeeper构建分布式定时任务

本文涉及的源代码路径:https://github.com/xiaoquqi/openstackclient-demo/tree/master/tooz 一、目前现状及存在的问题 在实际业务系统中,经常有需要定时执行的任务,例如任务状态的定时更新、定时发送状态信息等。在我们的云迁移产品中,允许用户可以设定周期同步规则,定期执行数据同步并调用云平台接口执行快照操作。在单机版本中,通常在同一时间点并发任务量较少的情况下,问题并不是很突出,但是随着我们将云迁移服务从单机版本改造为平台版本后,当多个用户的多台主机同时触发快照任务时,一方面传统的设计方式就成为了瓶颈,无法保证用户的同步任务在同一时间点被触发(需要排队);另外一方面,目前Active-Passive(简称AP方式)的高可靠部署方式无法利用集群横向扩展能力,无法满足高并发的要求。

更多 →

2020-03-24

深度解读OpenStack Mitaka国内代码贡献

转眼间,OpenStack又迎来了新版本发布的日子,这是OpenStack第13个版本,也是Big Tent后的第二个版本,秉承“公开公正”的原则,OpenStack Release的项目达到了29个,比Liberty多出了8个。

更多 →

2016-04-07

Consul主要使用场景

假设你已经按照之前的Consul安装方法部署了一套具备环境,具体方法可以参考:http://xiaoquqi.github.io/blog/2015/12/07/consul-installation/

更多 →

2015-12-24

Consul的安装方法

什么是Consul? Consul拥有众多的组件,简言之,就是一个用于在你的基础设施中,发现和配置服务的工具。包含以下关键功能:服务发现、健康检查、键值存储和多数据中心支持。再说的通俗一点,就是用于管理分布式系统的利器。

更多 →

2015-12-07

使用Grafana+Diamond+Graphite构造完美监控面板

服务器监控软件五花八门,没有一个是对的,但是总有一款是适合你的,本文中将使用Grafana+Dimaond+Graphite构造一款漂亮的监控面板,你可以独自欣赏,也可以让他们和你的应用勾勾搭搭。

更多 →

2015-12-01

使用MongoDB作为Salt Pillar后端存储数据

今天在查找salt中pillar嵌套pillar的方法时,无意之间发现了pillar除了可以直接使用文件(sls)外,也同时支持多种后端的数据存储方式。例如:MySQL, MongoDB, Ldap, json, cobbler甚至是puppet。这无疑为开发中的接口提供了极大的便利。

更多 →

2015-02-23