K8S

架构

Kubernetes Master

Node

Pod

Controller

环境搭建

公共安装

cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet
systemctl restart kubelet

Master节点

kubeadm init --apiserver-advertise-address=192.168.150.111 --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl applay -f https://raw.githubusercontentcom/coreos/flannel/master/Documentation/kube-flannel.yml

Slave节点

kubeadm join 192.168.150.111 --token 

容器编排

部署pod

apiVersion: v1
kind: Pod
metadata:
  name: testnginx
spec:
  containers:
  - name: nginx
    image: nginx:1.7.9

部署deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: testnginx
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: web_server
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9

服务发现与负载均衡

存储

Volume

配置

创建方式

传递方式

认证和授权

认证

授权

集群监控

监控纬度

Prometheus

ELK->EFK

弹性扩缩容

云平台实现

常用命令

发表评论

发表
Table of Contents