Docker kubernetes Dashboard Installation Deployment Details _docker

Source: Internet
Author: User
Tags etcd docker registry k8s kubernetes dashboard aliyun egrep value store

Kubernetes Dashboard deployment of Docker


1. Environment Description:

1). Structure:

Note: This experiment server environment all uses CentOS 7. The service installs all adopt Yum install.

192.168.3.7 Master
192.168.3.16 node

2). Software packages used:

Master:docker Kubernetes-master Etcd Flannel
Nodes:docker Kubernetes-node Flannel

3). Software version:

docker:1.10.3
Kubernetes*: 1.2.0
etcd:2.3.7

4). Package Description:

Docker: The main character, needless to say.
Kubernetes-master:kubernetes Service Side
Kubernetes-node:kubernetes Client
ETCD: Server-discovered key value store
Flannel: Network interoperability between Docker containers on multiple servers

2. Environment initialization:

You have Docker, initialize what to do, I will not teach you.
Back up the existing Yum source files, engage in a Aliyun yum source, Epel source.
Address: http://mirrors.aliyun.com

3. Installation configuration Docker:

Note: Docker adopts net mode. Make sure the Device-mapper package is installed or the Docker cannot start.

1). Install
# yum install docker-y
2). Configure
# cat/etc/sysconfig/docker|egrep-v "^#|^$"
options= "Docker
" _cert_path=/etc/docker
 

4. Configure Master

1). Install package.
# yum Install kubernetes-master etcd flannel-y
2). Configure ETCD.
# cat/etc/etcd/etcd.conf |egrep-v "^#|^$"
etcd_name=default
etcd_data_dir= "/var/lib/etcd/default.etcd"
etcd_listen_client_urls= "http://0.0.0.0:2379" # # Listening address Port
Etcd_advertise_client_urls= "http://192.168.3.7:2379" # # ETCD cluster configuration; multiple ETCD servers, add URLs directly behind

# #启动etcd服务
# Systemctl Start Etcd

3). Configure Kubernetes.

The following files are available in the/etc/kubernetes directory:
Apiserver:kubernetes API configuration File
Config:kubernetes Master configuration file
Controller-manager:kubernetes Cluster Management configuration file
Scheduler:kubernetes Scheduler configuration file

# cd/etc/kubernetes
kube_api_address= "--insecure-bind-address=0.0.0.0" # # KUBE the address that was bound at startup
kube_etcd_servers= "--etcd-servers=http://192.168.3.7:2379" # # KUBE calls Etcd URL
kube_service_addresses= "-- SERVICE-CLUSTER-IP-RANGE=172.17.0.0/16 "# # This address is the address segment of the Docker container
kube_admission_control="--admission-control= Namespacelifecycle,namespaceexists,limitranger,securitycontextdeny,resourcequota "
KUBE_API_ARGS=

" " Note Kube_admission_control This line of configuration: Remove the ServiceAccount item, otherwise it will report no authentication errors in the later stage.

# cat config |egrep-v "^#|^$"
kube_logtostderr= "--logtostderr=true" kube_log_level=
"--v=0"
Kube_allow _priv= "--allow-privileged=false"
kube_master= "--master=http://192.168.3.7:8080" # # KUBE MASTER API URL

Controller-manager Scheduler two files with a default configuration.

5. Configure nodes

1). Install package.

# yum Install Kubernetes-node flannel-y

2). Configure Kubernetes Node

After the package is installed, the following files appear in the/etc/kubernetes directory:

Config:kubernetes Master configuration file
Kubelet:kubelet node configuration file
Proxy:kubernetes Proxy configuration file

# cd/etc/kubernetes
# cat config |egrep-v "^#|^$"
kube_logtostderr= "--logtostderr=true"
kube_log_level= "--v=0"
kube_allow_priv= "--allow-privileged=false"
kube_master= "--master=http://192.168.3.7:8080" # # Kube Master API URL

# cat kubelet |egrep-v "^#|^$"
kubelet_address= "--address=0.0.0.0" # # Kubelet after boot binding address
K Ubelet_port= "--port=10250" # # Kubelet Port
kubelet_hostname= "--hostname-override=192.168.3.16" # Kubelet hostname, the name of the Kubectl get nodes displayed in master
kubelet_api_server= "--api-servers=http://192.168.3.7:8080" # # Kube Master API URL
kubelet_pod_infra_container= '--pod-infra-container-image=registry.access.redhat.com/ Rhel7/pod-infrastructure:latest "
kubelet_args=" "

Proxy configuration defaults.

6. Network configuration:

Master and node are already installed flannel

Master configuration:

# Cat/etc/sysconfig/flanneld |egrep-v "^#|^$"
flannel_etcd= "http://192.168.3.7:2379" "flannel_etcd_key="
Kube/network "

# etcdctl Mk/kube/network/config ' {" Network ":" 172.17.0.0/16 "} ' # # Note that IP is consistent with IP addresses that appear above.

Node configuration:

# Cat/etc/sysconfig/flanneld |egrep-v "^#|^$"
flannel_etcd= "http://192.168.3.7:2379" "flannel_etcd_key="
Kube/network "

7. Start the service.

1. Start Docker service.

# Systemctl Start Docker
# PS Aux|grep Docker # # Confirm that the service is starting normally. If not, please/var/log/message to see the problem

2). Start ETCD Service

# Systemctl Start Etcd

3. Start the Flanneld service on master and node

# Systemctl Start Flanneld

View IP, will appear flannel0 network interface device, this address and DOCKER0 address is consistent, if inconsistent please confirm that the above services are normal to start

4. Start the k8s service running on master.

Start order: Kube-apiserver.
# Systemctl Start Kube-apiserver
# Systemctl Start Kube-controller-manager
# Systemctl Start Kube-scheduler

Please verify that all of the above services have been started properly.

5. Start the K8s service running on node.
# Systemctl Start Kube-proxy
# Systemctl Start Kubelet

Please verify that all of the above services have been started properly.

6). Visit http://kube-apiserver:port
http://192.168.3.7:8080 View all Request URLs
Http://192.168.3.7:8080/healthz/ping View health status

8. Open K8s Dashboard:

1. Verify the service
on master. # Kubectl Get nodes # gets k8s client.
NAME status Age
192.168.3.16 Ready 6h
# Kubectl getting namespace # # get k8s all namespaces
name Status age
default Activ E 17h
2). New Kube-system on Master namespace
# Cd/usr/local/src/docker
# cat Kube-namespace.yaml {"
kind": " Namespace ",
" apiversion ":" V1 ",
" metadata ": {
" name ":" Kube-system "
}
}
# Kubectl Create-f Kube-namespace.yaml
namespace "Kube-system" created
# Kubectl get namespace # # gets k8s all namespaces
NAME STATUS Age
default Active 17h
Kube-system active 17h

3. Create a new Kube-dashboard.yaml on master

wget Http://docs.minunix.com/docker/kubernetes-dashboard.yaml-O/usr/local/src/docker/kube-dashboard.yaml

Please modify the apiserver-host in the file to your own kebu-apiserver

To create a pod:

# Kubectl Create-f Kube-dashboard.yaml
Deployment "Kubernetes-dashboard" created
have exposed your service on a external port on all nodes in your
Cluster. If you are want to expose this service to the external Internet
Need to set up firewall rules for the service port (s) (tcp:31576) to serve traffic.

Http://releases.k8s.io/release-1.2/docs/user-guide/services-firewalls.md for more details.
Service "Kubernetes-dashboard" created

Verify:

# Kubectl Get Pods--namespace=kube-system
NAME READY STATUS Restarts age
KUBERNETES-DASHBOARD-3138400848-GRTFM 1/1 containercreating 0 27s

To view the detailed procedures for this container:

# Kubectl describe pods KUBERNETES-DASHBOARD-3138400848-GRTFM--namespace=kube-system

When you have more than one node, you can use this command to see what node the container is assigned to, and the IP address that is assigned after startup.
If you see "state:running" in the results, move to node to see the container running state, which should also be the up state.

4). This can be accessed by Http://kube-apiserver:port/ui

Http://192.168.3.7:8080/ui

Start using Docker!

9. Note Points & Problems encountered:

1. Note The boot order of the service, especially master, to start the apiserver when the ETCD is started

2. Note the Yaml file format indentation.

3. If the status of the newly created pod is found to be depening, there may be several reasons: first, the client is configured with a listen 127.0.0.1 service, master cannot establish a connection with it; second, the environment initialization is not done; third, to node, View logs using Docker logs

4. The containers images address in the Kubernetes-dashboard.yaml file is currently public and will be closed on September 30.

5. If you have a foreign VPS, you can create Docker registry on the server, first pull the k8s dashboard of Google, then push to their own registry, modify the image of the next yaml.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.