117主机 | k8s master +k8s minion+flannel+docker |
110 | etcd |
73主机 | K8s minion+docker+flannel |
$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
cd /opt/kubernetes/bin
vi start_etcd.sh nohup ./etcd --name etcd001 \ --initial-advertise-peer-urls http://192.168.161.110:2380 \ --listen-peer-urls http://192.168.161.110:2380 \ --listen-client-urls http://192.168.161.110:2379,http://127.0.0.1:2379 \ --advertise-client-urls http://192.168.161.110:2379 \ --initial-cluster-token etcd-cluster⑴ \ --initial-cluster etcd001=http://192.168.161.110:2380 \ --initial-cluster-state new &
./start_etcd.sh
[root@linux⑴17 master]# vi start_k8s_master.sh #!/bin/sh nohup ./kube-apiserver \ --insecure-bind-address=0.0.0.0 \ --insecure-port=8080 \ --cors_allowed_origins=.* \ --etcd_servers=http://192.168.161.110:2379 \ --v=4 --logtostderr=true \ --log_dir=/opt/kubernetes/logs/k8s/apiserver \ --service-cluster-ip-range=10.10.10.0/24 & nohup ./kube-controller-manager \ --master=192.168.161.117:8080 \ --enable-hostpath-provisioner=false \ --v=1 --logtostderr=true \ --allocate-node-cidrs=true --cluster-cidr=10.1.0.0/16 \ --log_dir=/opt/kubernetes/logs/k8s/controller-manager & nohup ./kube-scheduler \ --master=192.168.161.117:8080 \ --v=1 --logtostderr=true \ --log_dir=/opt/kubernetes/logs/k8s/scheduler &
cd /opt/kubernetes/bin
vi k8s.minion.sh #! /bin/sh # start the minion nohup ./kubelet --address=0.0.0.0 \ --port=10250 \ --v=1 \ --log_dir=/opt/kubernetes/logs/k8s/kubelet \ --hostname_override=192.168.161.73 \ --container-runtime=docker \ --api_servers=http://192.168.161.117:8080 \ --logtostderr=false >> kublet.log 2>&1 & nohup ./kube-proxy \ --master=192.168.161.117:8080 \ --log_dir=/opt/kubernetes/logs/k8s/proxy \ --v=1 --logtostderr=false >> proxy.log 2>&1 &
./k8s.minion.sh
nohup ./flanneld -etcd-endpoints=http://192.168.161.110:2379 -remote=192.168.161.110:8888 >> /opt/kubernetes/flanenl.log 2>&1 & source /run/flannel/subnet.env
cd /opt/kubernetes/bin
nohup ./flanneld --listen=0.0.0.0:8888 >> /opt/kubernetes/logs/flanneld.log 2>&1 & /**在etcd服务器上设置子网*/
etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
source /run/flannel/subnet.env
ifconfig docker0 ${FLANNEL_SUBNET}
setsid docker daemon --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} --insecure-registry=192.168.161.117:5000 --registry-mirror=https://0ai1grsq.mirror.aliyuncs.com >docker.log 2>&1& ./k8s.minion.sh #重新启动kubelet、 kube-proxy
etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'设置的
[root@linux⑸f117 master]# more kubernetes-dashboard.yaml # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE⑵.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Configuration to deploy release version of the Dashboard UI. # # Example usage: kubectl create -f <this_file> kind: Deployment apiVersion: extensions/v1beta1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: replicas: 1 selector: matchLabels: app: kubernetes-dashboard template: metadata: labels: app: kubernetes-dashboard spec: containers: - name: kubernetes-dashboard image: designer9418/kubernetes-dashboard-amd64 imagePullPolicy: Always ports: - containerPort: 9090 protocol: TCP args: # Uncomment the following line to manually specify Kubernetes API server Host # If not specified, Dashboard will attempt to auto discover the API server and connect # to it. Uncomment only if the default does not work. - --apiserver-host=http://192.168.161.117:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 --- kind: Service apiVersion: v1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: type: NodePort ports: - port: 80 targetPort: 9090 selector: app: kubernetes-dashboard
上一篇 深入浅出Mybatis-分页
下一篇 数据结构:散列1(分离链接法)