Kubernetes Cetos 7 minimal Preinstallation (VMWare Workstation 15)

Step1: Download centos 7 minimal iso image and install it via vmware workstation 15

tbd

Step2: Configure static network interface

Edit -> Virtual Network Editor -> configure as following and -> NAT Settings... -> Start vm

 

Get Mac Adress of your instance by using:

cat /sys/class/net/{your network insterface}/address

-> 00:0c:29:71:91:df

start with editing “/etc/sysconfig/network-scripts/ifcfg-ens33″

vi /etc/sysconfig/network-scripts/ifcfg-ens33

add following configuration:

HWADDR=00:0C:29:71:91:DF
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPADDR=172:16.0.11
NETMASK=255.255.255.0
GATEWAY=172.16.0.2
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
DEVICE=ens33
UUID=ea68db6e-461e-427d-b9a8-bfcf6e1a4fc6
ONBOOT=yes

Configure default gateway

vi /etc/sysconfig/network

Add following line:

NETWORKING=yes
HOSTNAME=k8smaster
GATEWAY=172.16.0.2

Configure DNS Server

vi /etc/resolv.conf

Add following line:

nameserver 8.8.8.8
nameserver 8.8.4.4

Restart network service:

systemctl restart network
ping www.sohu.com

If it works, turn down vm -> shutdown now

Clone a second machine

set the right IPADDR, HWADDR and UUID for network interface then hostname for default gateway

how get UUID of this machine:

uuidgen ifcfg-ens33
# or
# echo UUID=$(uuidgen ifcfg-ens33) >> ifcfg-ens33
# then delete the original one

Now you have 3 virtual machines with different ips

For installation of common software like docker and some setting for preinstallation, I wrote a ansible script see my github (tbd)

The rest see:

https://www.digitalocean.com/community/tutorials/how-to-create-a-kubernetes-1-10-cluster-using-kubeadm-on-centos-7

Start master node with kubeadm init

kubeadm init --ignore-preflight-errors all --kubernetes-version=v1.11.1 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12

then wait.... your os will pull docker image from docker hub

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

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/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join 172.16.0.11:6443 --token s97rc5.oio179xrb0fbxrg2 --discovery-token-ca-cert-hash sha256:ade669b38cf81989baf62fae57cdc50cf8aba5db429841e33e6c090aded2730e

run
docker images

[[email protected]k8smaster ~]# docker images
REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
k8s.gcr.io/kube-proxy-amd64                v1.11.1             d5c25579d0ff        5 months ago        97.8MB
k8s.gcr.io/kube-scheduler-amd64            v1.11.1             272b3a60cd68        5 months ago        56.8MB
k8s.gcr.io/kube-apiserver-amd64            v1.11.1             816332bd9d11        5 months ago        187MB
k8s.gcr.io/kube-controller-manager-amd64   v1.11.1             52096ee87d0e        5 months ago        155MB
k8s.gcr.io/coredns                         1.1.3               b3b94275d97c        7 months ago        45.6MB
k8s.gcr.io/etcd-amd64                      3.2.18              b8df3b177be2        8 months ago        219MB
k8s.gcr.io/pause                           3.1                 da86e6ba6ca1        12 months ago       742kB
[[email protected] ~]# 

validate your installation:

[[email protected] ~]# kubectl get nodes
NAME        STATUS     ROLES    AGE   VERSION
k8smaster   NotReady   master   18m   v1.11.1
[[email protected] ~]# 

status -> NotReady because you need a network addon like flannel

Install flannel

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

then you will see:

[email protected] ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.extensions/kube-flannel-ds-amd64 created
daemonset.extensions/kube-flannel-ds-arm64 created
daemonset.extensions/kube-flannel-ds-arm created
daemonset.extensions/kube-flannel-ds-ppc64le created
daemonset.extensions/kube-flannel-ds-s390x created

Validate pods: kubectl get pods -n kube-system

-n -> namespace

[[email protected] ~]# kubectl get pods -n kube-system
NAME                                READY   STATUS    RESTARTS   AGE
coredns-78fcdf6894-5v9g9            1/1     Running   0          27m
coredns-78fcdf6894-lpwfw            1/1     Running   0          27m
etcd-k8smaster                      1/1     Running   0          1m
kube-apiserver-k8smaster            1/1     Running   0          1m
kube-controller-manager-k8smaster   1/1     Running   0          1m
kube-flannel-ds-amd64-n5j7l         1/1     Running   0          1m
kube-proxy-rjssr                    1/1     Running   0          27m
kube-scheduler-k8smaster            1/1     Running   0          1m

Now adding two worker nodes to cluster

on k8snode1

kubeadm join --ignore-preflight-errors all 172.16.0.11:6443 --token s97rc5.oio179xrb0fbxrg2 --discovery-token-ca-cert-hash sha256:ade669b38cf81989baf62fae57cdc50cf8aba5db429841e33e6c090aded2730e

Validating on master node with:

[[email protected] ~]# kubectl get pods -n kube-system -o wide
NAME                                READY   STATUS    RESTARTS   AGE   IP            NODE
coredns-78fcdf6894-5v9g9            1/1     Running   0          40m   10.244.0.2    k8smaster
coredns-78fcdf6894-lpwfw            1/1     Running   0          40m   10.244.0.3    k8smaster
etcd-k8smaster                      1/1     Running   0          14m   172.16.0.11   k8smaster
kube-apiserver-k8smaster            1/1     Running   0          14m   172.16.0.11   k8smaster
kube-controller-manager-k8smaster   1/1     Running   0          14m   172.16.0.11   k8smaster
kube-flannel-ds-amd64-hs6b9         1/1     Running   0          3m    172.16.0.12   k8snode1
kube-flannel-ds-amd64-n5j7l         1/1     Running   0          14m   172.16.0.11   k8smaster
kube-proxy-8x5p6                    1/1     Running   0          3m    172.16.0.12   k8snode1
kube-proxy-rjssr                    1/1     Running   0          40m   172.16.0.11   k8smaster
kube-scheduler-k8smaster            1/1     Running   0          14m   172.16.0.11   k8smaster

The same on k8snode2...

[[email protected] ~]# kubectl get nodes
NAME        STATUS   ROLES    AGE   VERSION
k8smaster   Ready    master   43m   v1.11.1
k8snode1    Ready    <none>   6m    v1.11.1
k8snode2    Ready    <none>   40s   v1.11.1
[[email protected] ~]# kubectl get pods -n kube-system -o wide
NAME                                READY   STATUS    RESTARTS   AGE   IP            NODE
coredns-78fcdf6894-5v9g9            1/1     Running   0          44m   10.244.0.2    k8smaster
coredns-78fcdf6894-lpwfw            1/1     Running   0          44m   10.244.0.3    k8smaster
etcd-k8smaster                      1/1     Running   0          17m   172.16.0.11   k8smaster
kube-apiserver-k8smaster            1/1     Running   0          17m   172.16.0.11   k8smaster
kube-controller-manager-k8smaster   1/1     Running   0          17m   172.16.0.11   k8smaster
kube-flannel-ds-amd64-8gpzz         1/1     Running   0          1m    172.16.0.13   k8snode2
kube-flannel-ds-amd64-hs6b9         1/1     Running   0          7m    172.16.0.12   k8snode1
kube-flannel-ds-amd64-n5j7l         1/1     Running   0          17m   172.16.0.11   k8smaster
kube-proxy-8x5p6                    1/1     Running   0          7m    172.16.0.12   k8snode1
kube-proxy-jkpgf                    1/1     Running   0          1m    172.16.0.13   k8snode2
kube-proxy-rjssr                    1/1     Running   0          44m   172.16.0.11   k8smaster
kube-scheduler-k8smaster            1/1     Running   0          17m   172.16.0.11   k8smaster

Done :-)

原文地址:https://www.cnblogs.com/crazy-chinese/p/10166571.html

时间: 2024-11-08 17:53:20

Kubernetes Cetos 7 minimal Preinstallation (VMWare Workstation 15)的相关文章

VMware Workstation 15 Pro 永久激活密钥

永久激活密钥UG5J2-0ME12-M89WY-NPWXX-WQH88 GA590-86Y05-4806Y-X4PEE-ZV8E0 YA18K-0WY8P-H85DY-L4NZG-X7RAD UA5DR-2ZD4H-089FY-6YQ5T-YPRX6 B806Y-86Y05-GA590-X4PEE-ZV8E0 ZF582-0NW5N-H8D2P-0XZEE-Z22VA VMware Workstation 15 Pro 永久激活密钥 原文地址:http://blog.51cto.com/anpi

【Linux】一步一步学Linux——VMware Workstation 15 Pro安装图解教程(06)

目录 00. 目录 01. VMware Workstation Pro15下载 02. VMware Workstation Pro15安装 03. VMware Workstation Pro 15序列号 04. 附录 00. 目录 @ 01. VMware Workstation Pro15下载 VMware Workstation Pro15下载 02. VMware Workstation Pro15安装 第一步: 运行安装程序,点下一步 第二步: 接收许可协议,点击下一步 第三步:选

Windows10下安装VMware workstation 15.1虚拟机+配置Ubuntu16系统

一.下载Ubuntu和VMware workstation 1. Ubuntu 2. VMware workstation 二.安装 下载完成后,打开VMware workstation,按照安装程序流程进行安装: 安装完成后,双击打开,输入秘钥(网上可以搜索到),进入主界面: 点击左边的创建新的虚拟机,选择‘典型’,点击‘下一步’,选择已经下载的Ubuntu镜像文件,点击下一步 设置Linux的用户名和密码, 接下来命名和选择虚拟机的位置,给Linux分配合适的硬盘空间,这里按照自己电脑的情况

VMware WorkStation 15 Pro 激活序列号

YG5H2-ANZ0H-M8ERY-TXZZZ-YKRV8 UG5J2-0ME12-M89WY-NPWXX-WQH88 UA5DR-2ZD4H-089FY-6YQ5T-YPRX6 GA590-86Y05-4806Y-X4PEE-ZV8E0 ZF582-0NW5N-H8D2P-0XZEE-Z22VA YA18K-0WY8P-H85DY-L4NZG-X7RAD 原文地址:http://blog.51cto.com/pinck/2287360

VMware Workstation Pro 15密钥及下载地址

VMware Workstation 15 密钥 YG5H2-ANZ0H-M8ERY-TXZZZ-YKRV8UG5J2-0ME12-M89WY-NPWXX-WQH88UA5DR-2ZD4H-089FY-6YQ5T-YPRX6GA590-86Y05-4806Y-X4PEE-ZV8E0ZF582-0NW5N-H8D2P-0XZEE-Z22VAYA18K-0WY8P-H85DY-L4NZG-X7RADVV502-47Z16-M85AQ-Q7PX9-QLA8D 下载地址 https://download

VMware workstation pro 15 安装Ubuntu(图文教程)

今天分享一下虚拟机安装Ubuntu的过程,在开始安装之前,需要下载VMware workstation pro和Ubuntu镜像,两者我都用的最新版,由于VMware workstation pro 15是付费的软件,不想花钱的小伙伴可以去百度搜索激活密钥! VMware workstation pro 15 下载地址:https://www.vmware.com/products/workstation-pro.html Ubuntu 下载地址:https://www.ubuntu.com/d

威睿虚拟机 VMware Workstation Pro 15.1.0 中文版 + 注册机

PC上最强大的虚拟机软件 VMware Workstation Pro 更新到 v15 版本.VMware Workstation,中文名“威睿工作站”,是一款功能强大的桌面虚拟计算机软件,提供用户可在单一的桌面上同时运行不同的操作系统,和进行开发.测试 .部署新的应用程序的最佳解决方案.VMware Workstation 可在一部实体机器上模拟完整的网络环境,以及可便于携带的虚拟机器,其更好的灵活性与先进的技术胜过了市面上其他的虚拟计算机软件.对于企业的 IT开发人员和系统管理员而言, VM

虚拟机 VMware Workstation Pro 15.5.0 及永久激活密钥

激活密钥许可证VMware Workstation Pro 15.5(亲测可用) 激活许可证 UY758-0RXEQ-M81WP-8ZM7Z-Y3HDA VF750-4MX5Q-488DQ-9WZE9-ZY2D6 UU54R-FVD91-488PP-7NNGC-ZFAX6 YC74H-FGF92-081VZ-R5QNG-P6RY4 YC34H-6WWDK-085MQ-JYPNX-NZRA2 VMware Workstation Pro 15.5官方安装包下载地址: 链接:https://pan.

虚拟机 VMware Workstation Pro 15.5.0 及永久激活密钥外加添加共享文件夹

虚拟机下载地址:https://download3.vmware.com/software/wkst/file/VMware-workstation-full-15.5.0-14665864.exe 激活密钥许可证VMware Workstation Pro 15 激活许可证UY758-0RXEQ-M81WP-8ZM7Z-Y3HDAVF750-4MX5Q-488DQ-9WZE9-ZY2D6UU54R-FVD91-488PP-7NNGC-ZFAX6YC74H-FGF92-081VZ-R5QNG-P