1.安装Flanne(构建overlay网络)
Flannel网络原理
yum install flannel
vi /etc/sysconfig/flanneld
Flanneld configuration options
etcd url location. Point this to the server where etcd runs
FLANNELETCDENDPOINTS="http://etcd:2379"
etcd config key. This is the configuration key that flannel queries
For address range assignment
FLANNELETCDPREFIX="/atomic.io/network"
Any additional options that you want to pass
FLANNEL_OPTIONS=""
etcdctl mk /atomic.io/network/config '{ "Network": "192.168.0.0/16" }'
{ "Network": "192.168.0.0/16" }
master
systemctl enable flanneld.service
systemctl start flanneld.service
service docker restart
systemctl restart kube-apiserver.service
systemctl restart kube-controller-manager.service
systemctl restart kube-scheduler.service
node
systemctl enable flanneld.service
systemctl start flanneld.service
service docker restart
systemctl restart kubelet.service
systemctl restart kube-proxy.service
看获取的ip地址是否正确
kubectl get pods --all-namespaces -o wide
vi kubernetes-dashboard.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# Keep the name in sync with image version and
# gce/coreos/kube-manifests/addons/dashboard counterparts
name: kubernetes-dashboard-latest
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: kubernetes-dashboard
version: latest
kubernetes.io/cluster-service: "true"
spec:
containers:
- name: kubernetes-dashboard
image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
memory: 50Mi
ports:
- containerPort: 9090
args:
- --apiserver-host=http://192.168.229.141:8080
livenessProbe:
httpGet:
path: /
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
---
kind: Service
metadata:
name: kubernetes-dashboard
namespace: kube-system
labels:
k8s-app: kubernetes-dashboard
kubernetes.io/cluster-service: "true"
spec:
selector:
k8s-app: kubernetes-dashboard
ports:
- port: 80
targetPort: 9090
创建dashboard
kubectl create -f kubernetes-dashboard.yaml
kubectl get -f kubernetes-dashboard.yaml
image.png
网友评论