一.kubectl run命令拓展 1.RC创建 [root@k8s-master ~]# kubectl run web --generator=run/v1 --image=10.0.128.0:5000/nginx:1.13 --replicas=3 replicationcontroller "web" created 2.deployment创建 [root@k8s-master ~]# kubectl run web --image=10.0.128.0:5000/ngin…
一.通过文件创建deployment 1.创建deployment文件 [root@k8s-master ~]# cat nginx_deploy.yml apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 template: metadata: labels: app: nginx spec: containers: - name: nginx im…
一.文件创建带--record 1.文件 [root@k8s-master ~]# cat nginx_deploy.yml apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 template: metadata: labels: app: nginx spec: containers: - name: nginx image: 10.0.128.0…
一.自动伸缩 1.启动 [root@k8s-master ~]# kubectl autoscale deployment nginx-deployment --max=8 --min=2 --cpu-percent=80 deployment "nginx-deployment" autoscaled 2.查看创建 [root@k8s-master ~]# kubectl get all NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE de…
一.nginx保证有两个版本 1.查看当前容器运行nginx版本 [root@k8s-master ~]# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE myweb-7w38b 1/1 Running 0 4h 172.16.10.4 k8s-node1 myweb-btflm 1/1 Running 0 4h 172.16.48.4 k8s-node2 myweb-cbt47 1/1 Running 0 4h 17…
一.创建实验文件 [root@k8s-master ~]# cat myweb-rc.yml apiVersion: v1 kind: ReplicationController metadata: name: myweb spec: replicas: 3 selector: app: myweb template: metadata: labels: app: myweb spec: containers: - name: nginx image: 10.0.128.0:5000/nginx…
一.环境规划 1.架构拓扑图 2.主机规划 3.软件版本 [root@k8s-master ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@k8s-master ~]# uname -r 3.10.0-693.el7.x86_64 [root@k8s-master ~]# docker version Client: Version: 1.12.6 API version: 1.24 Package v…
一.pod初体验 1.编辑k8s_pod.yml文件 [root@k8s-master ~]# cat k8s_pod.yml apiVersion: v1 kind: Pod metadata: name: nginx labels: app: web spec: containers: - name: nginx image: 10.0.128.0:5000/nginx:latest ports: - containerPort: 80 2.下载镜像并上传到私有仓库 [root@k8s-ma…
一.如何实现外界能访问 外界访问不了 1.启动svc [root@k8s-master ~]# cat myweb-svc.yaml apiVersion: v1 kind: Service metadata: name: nginx spec: type: NodePort ports: - port: 80 nodePort: 30001 selector: app: myweb [root@k8s-master ~]# kubectl create -f myweb-svc.yaml se…
一.rc控制器常用命令 1.rc控制器信息查看 [root@k8s-master ~]# kubectl get replicationcontroller NAME DESIRED CURRENT READY AGE myweb 3 3 3 3m [root@k8s-master ~]# kubectl get rc NAME DESIRED CURRENT READY AGE myweb 3 3 3 5m 2.删除rc [root@k8s-master ~]# kubectl delete…