摘要:
一、基本概念1、访问模式:ReadWriteOnce:该卷可以被单个节点以读/写模式挂载ReadOnlyMany:该卷可以被多个节点以只读模式挂载ReadWriteMany:该卷可以被多个节点以读/写模式挂载命令行中,访问模式缩写为:RWO-ReadWriteOnceROX-ReadOnlyMany 阅读全文
posted @ 2019-11-29 16:13
xw115428
阅读(685)
评论(0)
推荐(0)
摘要:
主要用来保存用户名和密码,要求储存的为base64格式1、生成base64类型的用户名密码 #用户名 [root@k8s-master01-etcd01 ~]# echo -n "root"|base64 cm9vdA== #密码 [root@k8s-master01-etcd01 ~]# echo 阅读全文
posted @ 2019-11-29 16:07
xw115428
阅读(173)
评论(0)
推荐(0)
摘要:
1、使用目录创建#创建两个配置文件 [root@k8s-master01-etcd01 dir]# ls game.properties test.conf [root@k8s-master01-etcd01 dir]# cat game.properties name=xiangwei age=2 阅读全文
posted @ 2019-11-29 16:01
xw115428
阅读(280)
评论(0)
推荐(0)
摘要:
1、emptyDir创建一个空卷,挂载到Pod中的容器。Pod删除该卷也会被删除。应用场景:Pod中容器之间数据共享 apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: write image: cent 阅读全文
posted @ 2019-11-29 15:54
xw115428
阅读(220)
评论(0)
推荐(0)
摘要:
1、使用购买的ca证书在k8s中创建一个secret kubectl create secret tls test-secret(自己起一个名字) --cert=证书颁发机构给你的.cert文件 --key=证书颁发机构给你的key文件 2、查看 kubectl get secret 3、创建ing 阅读全文
posted @ 2019-11-29 15:51
xw115428
阅读(359)
评论(0)
推荐(0)
摘要:
示例: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: tomcat-ingress spec: rules: - host: xw.nginx.com http: paths: - path: / backend: serv 阅读全文
posted @ 2019-11-29 15:33
xw115428
阅读(523)
评论(0)
推荐(0)
摘要:
apiVersion: v1 kind: Service metadata: name: nginx-service labels: app: nginx spec: sessionAffinity: ClientIP #会话保持 sessionAffinityConfig: clientIP: t 阅读全文
posted @ 2019-11-29 15:31
xw115428
阅读(534)
评论(0)
推荐(0)
摘要:
挂起(Pending):Pod 已被 Kubernetes 系统接受,但有一个或者多个容器镜像尚未创建。等待时间包括调度 Pod 的时间和通过网络下载镜像的时间,这可能需要花点时间 运行中(Running):该 Pod 已经绑定到了一个节点上,Pod 中所有的容器都已被创建。至少有一个容器正在运行, 阅读全文
posted @ 2019-11-29 15:29
xw115428
阅读(255)
评论(0)
推荐(0)
摘要:
main containers启动之前还会有个start动作,结束后有个stop动作 示例: apiVersion: v1 kind: Pod metadata: name: lifecycle-demo spec: containers: - name: lifecycle-demo-nginx 阅读全文
posted @ 2019-11-29 15:28
xw115428
阅读(176)
评论(0)
推荐(0)
摘要:
一、健康检查Probe有以下两种类型:livenessProbe如果检查失败,将杀死容器,根据Pod的restartPolicy来操作。Liveness 探测可以告诉 Kubernetes 什么时候通过重启容器实现自愈readinessProbe如果检查失败,Kubernetes会把Pod从serv 阅读全文
posted @ 2019-11-29 15:23
xw115428
阅读(236)
评论(0)
推荐(0)
摘要:
1、资源限制Pod和Container的资源请求和限制: spec.containers[].resources.limits.cpu spec.containers[].resources.limits.memory spec.containers[].resources.requests.cpu 阅读全文
posted @ 2019-11-29 15:15
xw115428
阅读(332)
评论(0)
推荐(0)
摘要:
1、镜像拉取策略IfNotPresent:默认值,镜像在宿主机上不存在时才拉取Always:每次创建Pod 都会重新拉取一次镜像Never:Pod 永远不会主动拉取这个镜像注意:如果省略imagePullPolicy 镜像tag为 :latest 策略为always ,否则 策略为 IfNotPre 阅读全文
posted @ 2019-11-29 15:03
xw115428
阅读(1008)
评论(0)
推荐(0)
摘要:
1、Infrastructure Container:基础容器维护整个Pod网络空间,启动一个容器时,k8s会自动为我们启动一个基础容器配置: [root@k8s-node02 ~]# cat /opt/kubernetes/cfg/kubelet.conf |grep "infra-contain 阅读全文
posted @ 2019-11-29 14:58
xw115428
阅读(788)
评论(0)
推荐(0)
摘要:
apiVersion: v1 #创建一个新的命名空间 kind: Namespace metadata: name: test apiVersion: apps/v1 #资源版本,可使用 kubectl api-versions命令查看有哪些,只有指定具体的资源版本才有相关的资源来使用 kind: 阅读全文
posted @ 2019-11-29 14:47
xw115428
阅读(783)
评论(0)
推荐(0)
摘要:
[root@k8s-master01 k8s]# yum install -y bash-completion [root@k8s-master01 k8s]# source /usr/share/bash-completion/bash_completion # source <(kubectl 阅读全文
posted @ 2019-11-29 11:15
xw115428
阅读(191)
评论(0)
推荐(0)
摘要:
客户端使用kubectl访问由于默认使用的Http访问,在master中访问是连接的http://127.0.0.1:8080地址,客户端只能通过10.16.8.156:6443访问,需要配置https 1、生成证书 [root@k8s-master01 k8s]# pwd /root/k8s/tl 阅读全文
posted @ 2019-11-29 11:12
xw115428
阅读(555)
评论(0)
推荐(0)
摘要:
1、创建kubectl run nginx --replicas=3 --labels="app=example" --image=nginx:1.10 --port=80 --record2、查看kubectl get deploykubectl get pods --show-labelskub 阅读全文
posted @ 2019-11-29 11:09
xw115428
阅读(231)
评论(0)
推荐(1)
摘要:
[root@k8s-master01-etcd01 yaml]# cat mandatory.yaml apiVersion: v1 kind: Namespace metadata: name: ingress-nginx labels: app.kubernetes.io/name: ingre 阅读全文
posted @ 2019-11-29 11:05
xw115428
阅读(265)
评论(0)
推荐(0)
摘要:
1、下载docker-compose [root@k8s-node01 ~]# curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o 阅读全文
posted @ 2019-11-29 11:03
xw115428
阅读(257)
评论(0)
推荐(0)
摘要:
主节点: yum install keepalived vi /etc/keepalived/keepalived.conf global_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@ 阅读全文
posted @ 2019-11-29 10:59
xw115428
阅读(239)
评论(0)
推荐(0)
摘要:
1、部署一个master02 从master01上拷贝配置、安装、启动文件到master02上 [root@k8s-master01 ~]# scp -r /opt/kubernetes/ 10.16.8.151:/opt [root@k8s-master01 ~]# scp -r /opt/etc 阅读全文
posted @ 2019-11-29 10:55
xw115428
阅读(486)
评论(0)
推荐(0)
摘要:
1、coredns.yaml [root@k8s-master01 yaml]# cat coredns.yaml # Warning: This is a file generated from the base underscore template file: coredns.yaml.bas 阅读全文
posted @ 2019-11-29 10:49
xw115428
阅读(1111)
评论(0)
推荐(0)
摘要:
1、部署ui [root@k8s-master01 yaml]# cat dashboard.yaml # Copyright 2017 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the " 阅读全文
posted @ 2019-11-29 10:46
xw115428
阅读(397)
评论(0)
推荐(0)
摘要:
1、创建一个授权的yaml文件 [root@k8s-master01 yaml]# cat apiserver-to-kubelet-rbac.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: anno 阅读全文
posted @ 2019-11-29 10:42
xw115428
阅读(1247)
评论(0)
推荐(0)
摘要:
1、安装cni插件 二进制包下载地址:https://github.com/containernetworking/plugins/releases [root@k8s-master01 node]# mkdir cni/bin -p [root@k8s-master01 node]# tar xf 阅读全文
posted @ 2019-11-29 10:33
xw115428
阅读(869)
评论(0)
推荐(0)
摘要:
1、安装docker,在Node节点上面操作 yum安装 yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/lin 阅读全文
posted @ 2019-11-29 10:27
xw115428
阅读(533)
评论(0)
推荐(0)
摘要:
1、下载下载地址:https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md 这个二进制包中包含了master和node的所有组件 2、创建对应的目录,并将二进制包中对应的可执行文件拷贝到对应目录 [root@k8s- 阅读全文
posted @ 2019-11-29 10:13
xw115428
阅读(439)
评论(0)
推荐(0)
摘要:
1、创建CA配置json文件 [root@k8s-master01 k8s]# cat ca-csr.json { "CN": "kubernetes", "key": { "algo": "rsa", "size": 2048 }, "names": [ { "C": "CN", "L": "Hu 阅读全文
posted @ 2019-11-29 10:02
xw115428
阅读(1457)
评论(0)
推荐(0)
摘要:
1、下载安装二进制下载:https://github.com/coreos/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz 1 [root@k8s-master01 ~]# tar xf etcd-v3.3.13-linu 阅读全文
posted @ 2019-11-29 09:57
xw115428
阅读(605)
评论(0)
推荐(0)
摘要:
准备工作需要两套证书,一套k8s通讯使用,一套etcd内部通讯使用 下载证书生成工具 [root@k8s-master01 k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -o /usr/local/bin/cfssl [root 阅读全文
posted @ 2019-11-29 09:47
xw115428
阅读(1440)
评论(0)
推荐(0)
摘要:
所有机器上操作 #关闭防火墙 [root@etcd01 ~]# systemctl stop firewalld [root@etcd01 ~]# systemctl disable firewalld #关闭selinux [root@k8s-master02 ~]# swapoff -a [ro 阅读全文
posted @ 2019-11-29 09:37
xw115428
阅读(361)
评论(0)
推荐(0)
摘要:
1、服务器配置推荐: 2、机器说明: 3、master组件 kube-apiserver Kubernetes API,集群的统一入口,各组件协调者,以RESTful API提供接口服务,所有对象资源的增删改查和监听操作都交给APIServer处理后再提交给Etcd存储。 kube-controll 阅读全文
posted @ 2019-11-29 09:32
xw115428
阅读(315)
评论(0)
推荐(0)

浙公网安备 33010602011771号