CENTOS7 Build Kubernetes-dashboard Management Service

Source: Internet
Author: User
Tags etcd k8s



First, prerequisites


1, first you will have ready-made kubernetes cluster, if you have nothing now, please refer to:

http://zlyang.blog.51cto.com/1196234/1951010

2, the proposed use ETCD cluster, the construction process please refer to:

http://zlyang.blog.51cto.com/1196234/1951164


Ii. Deployment of Kubernetes-dashboard

[All machines: Master, Node1, Node2]

1, install flannel (Flannel for Management containers Network)

[Email protected] ~]# yum-y install epel-release flannel


2, Configuration Flanel


[Master]

[Email protected] ~]# Vim/etc/sysconfig/flanneld

# Flanneld configuration options


# ETCD URL location. Point the server where ETCD runs

Flannel_etcd_endpoints= "http://k8s-master:2379"


# ETCD config key. This is the configuration key, that flannel queries

# for Address range assignment

flannel_etcd_prefix= "/atomic.io/network"


# any additional options-want to pass

#FLANNEL_OPTIONS = ""


[Node]

[Email protected] ~]# Vim/etc/sysconfig/flanneld

# Flanneld configuration options


# ETCD URL location. Point the server where ETCD runs

Flannel_etcd_endpoints= "http://k8s-master:2379"


# ETCD config key. This is the configuration key, that flannel queries

# for Address range assignment

flannel_etcd_prefix= "/atomic.io/network"


# any additional options-want to pass

#FLANNEL_OPTIONS = ""


3. Add ETCD Network Configuration

[Master]

[Email protected] ~]# mkdir-p/atomic.io/network/

[Email protected] ~]# chmod-r 777/atomic.io

[[email protected] ~]# etcdctl mk/atomic.io/network/config ' {"Network": "10.254.0.0/16"} '

****** Note: This IP is in/etc/kubernetes/apiserver {kube_service_addresses= "--service-cluster-ip-range=10.254.0.0/16" } fill in the address


4. Start Flannel Service

[All Machines]

[Email protected] ~]# systemctl start Flanneld.service

[Email protected] ~]# Systemctl enable Flanneld.service


5, modify kubernetes all node nodes kubelet settings to add DNS information, or will error

[Node1/node2]

[Email protected] ~]# Vim/etc/kubernetes/kubelet

###

# kubernetes Kubelet (Minion) config


# The address for the info server to serve in (set to 0.0.0.0 or "" for all Interfaces)

Kubelet_address= "--address=0.0.0.0"


# The port for the info server to serve on

Kubelet_port= "--port=10250"


# Leave this blank to use the actual hostname

Kubelet_hostname= "--hostname-override=k8s-node1"


# Location of the Api-server

Kubelet_api_server= "--api-servers=http://k8s-master:8080"


# POD Infrastructure container

Kubelet_pod_infra_container= "--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"


# ADD Your own!

#KUBELET_ARGS = ""

kubelet_args= "--cluster-dns=223.5.5.5--cluster-domain=k8s-master"


6. Restart the service on node

[Master]

For SERVICES in Flanneld etcd kube-apiserver Kube-controller-manager Kube-scheduler;     Do systemctl restart $SERVICES;     Systemctl enable $SERVICES;   Systemctl status $SERVICES; Done


[Node]

For SERVICES in Flanneld Kube-proxy Kubelet Docker;     Do systemctl restart $SERVICES;     Systemctl enable $SERVICES; Systemctl status $SERVICES; Done


7, installation dashboard

[Node1/node2]

A, import images

* * * Due to wall reasons, you need to first import images, if you can flip the wall, ignore this step


B, import:

[[email protected] ~]# Docker load < kubernetes-dashboard.tar.gz


C, view

[email protected] ~]# Docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

GCR.IO/GOOGLE_CONTAINERS/KUBERNETES-DASHBOARD-AMD64 v1.6.2 bd4d50b8499e 8 days ago 139 MB


8. Create Dashboard Container

[Master]

A. Download Kubernetes-dashboar.yaml file

[[email protected] ~]# git clone https://github.com/jdedu/kubernetes.git


B, modify the red item

[Email protected] ~]# vim Kubernetes/kubernetes-dashboard.yaml

Kind:deployment

Apiversion:extensions/v1beta1

Metadata

Labels

App:kubernetes-dashboard

version:v1.1.1

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:gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.2

Imagepullpolicy:always

Ports

-containerport:9090

Protocol:tcp

Args

---apiserver-host=http://192.168.80.130: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


9. Create Dashboard Container

[Master]

[Email protected] ~]# Kubectl create-f Kubernetes-dashboard.yaml

Deployment "Kubernetes-dashboard" created

Service "Kubernetes-dashboard" created

10. View status

A. View Pods

[[email protected] ~]# Kubectl get pods--namespace=kube-system

NAME Ready STATUS Restarts

Kubernetes-dashboard-1607234690-3bnk2 0/1 containercreating 0 34s


B. View build Details

[Email protected] ~]# Kubectl describe pods KUBERNETES-DASHBOARD-1607234690-3BNK2--namespace=kube-system


Name:kubernetes-dashboard-1607234690-3bnk2

Namespace:kube-system

node:k8s-node2/192.168.80.132

Start Time:thu, Geneva 2017 17:15:50 +0800

Labels:app=kubernetes-dashboard

pod-template-hash=1607234690

Status:pending

Ip:

controllers:replicaset/kubernetes-dashboard-1607234690

Containers:

Kubernetes-dashboard:

Container ID:

image:gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.2

Image ID:

Port:9090/tcp

Args:

--apiserver-host=http://192.168.80.130:8080

State:waiting

Reason:containercreating

Ready:false

Restart count:0

Liveness:http-get http://:9090/delay=30s timeout=30s period=10s #success =1 #failure =3

Volume Mounts: <none>

Environment Variables: <none>

Conditions:

Type Status

Initialized True

Ready False

Podscheduled True

No volumes.

QoS Class:besteffort

Tolerations: <none>

Events:

Firstseen lastseen Count from Subobjectpath Type Reason Message

--------- --------  ----- ----      ------------- --------  ------    -------

2m 2m 1 {default-scheduler} Normal scheduled successfully assigned KUBERNETES-DASHBOARD-1607234690-3BNK2 to K8s-node2

Third, testing

A, add host information on the test machine

192.168.80.130 K8s-master


B. Using the browser input: Http://k8s-master:8080/ui



Iv. errors

[ERROR 1]

[email protected] ~]# Kubectl describe pods kubernetes-dashboard-1607234690-3bnk2--namespace=kube-system


1s 1s 1 {kubelet k8s-node2} Warning failedsync Error syncing pod, skipping:failed to "Startcontainer" For "Kubernetes-dashboard" with Crashloopbackoff: "Back-off 10s restarting failed Container=kubernetes-dashboard pod= Kubernetes-dashboard-980055440-l9zl5_kube-system (870d02e1-7810-11e7-9517-000c296a54e8) "

Use Kubectl logs again to view specific error messages

[Email protected] ~]# kubectl logs KUBERNETES-DASHBOARD-1607234690-L6GFK--namespace=kube-system


No request provided. Skipping Authorization header

Error while initializing connection to Kubernetes Apiserver. This likely means, the cluster are misconfigured (e.g., it has invalid Apiserver certificates or service accounts Configuration) or the--apiserver-host param points to a server this does not exist. Reason:get http://k8s-master:8080/version:dial tcp:lookup k8s-master on 223.5.5.5:53:no such host

Refer to the Troubleshooting guide for more information:https://github.com/kubernetes/dashboard/blob/master/docs/ User-guide/troubleshooting.md


[Solutions]

[Email protected] ~]# vim Kubenetes-dashboard.yaml

---apiserver changed to IP, do not use domain name


This process may encounter many problems, if you need help, please email to: [Email protected]


This article is from the "Elephant" blog, make sure to keep this source http://zlyang.blog.51cto.com/1196234/1953399

CENTOS7 Build Kubernetes-dashboard Management Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.