K8s/k8s/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S/k8S

This article is in the group @Tianrain-Xiaowei @HongXiaolu @Logan and other gods under the guidance, and according to the “native Accelerated Chinese Kubernetes installation”, the final solution

Environment to prepare

The host name Host IP OS docker version ranhcer version
anjia-ubuntu 192.168.31.83 Ubuntu 17.04 4.9.0-12 – generic x86_64 Docker version 1.12.6 V1.6.11 – rc10

Install the docker

Docker-ce VERSIONS Getting Started with Hosts#SUPPORTED DOCKER VERSIONS install the SUPPORTED docker-ce version. Tencent Cloud image, Tsinghua Image, etc.)

Rancher K8s only supports Docker 1.12.3+ at present

sudo apt install docker.ioCopy the code

Install the rancher

According to the actual situation of Installing Rancher Server, it is recommended to use accelerator DaoCloud – the leading container cloud platform or Ali Cloud Docker accelerator

If rancher/ Server is v1.6.10 (not tried below V1.6.10), you need to modify the private Registry and push the gCR. IO plug-in to the private Registry, The namespace must be google_containers. If allowed, select V1.6.11 +(currently V1.6.11 is rc version). Select the version according to the actual situation

sudo docker run -d --restart=unless-stopped --name=rancher-server -p 8080:8080 rancher/server:v1.6.11-rc10 && sudo docker logs -f rancher-server
#sudo docker run -d --restart=unless-stopped --name=rancher-server -p 8080:8080 rancher/server:v1.6.10 && sudo docker logs -f rancher-serverCopy the code

registereddocker hub

Install k8s

If docker and K8S have been installed before, run this command

docker rm -f -v $(docker ps -aq) 
docker volume rm $(docker volume ls)
sudo rm -rf /var/etcd/Copy the code

Creating an Environment Template

Creating an Environment Template

Example Modify a K8S template

Private Registry for Add-Ons and Pod Infra Container Image index.docker.io

Image namespace for Add-Ons and Pod Infra Container Image anjia0532

Image namespace for kubernetes-helm Image anjia0532

Pod Infra Container Image anjia0532

Example Modify a K8S template

Example Modify a K8S template

Example Modify a K8S template

Create the K8S environment

Create the K8S environment

Select the K8S environment and add hosts

Select the K8S environment and add hosts

View k8S basic service status

When the base service is green, it can be used

View k8S basic service status

View the K8S Dashboard

View the K8S Dashboard

Abnormal screening

If you open dashboard report 503 ServiceUnavailable, thank you very much @Tianra-Li Xiaowei in the group for patiently answering this question and solving several problems by referring to the top 10 most common reasons for Kubernetes deployment failures (Part 1)

Open the Cli

> kubectl --namespace=kube-system  get pods
NAME                                   READY     STATUS             RESTARTS   AGE
heapster-79684d56d6-8pjrd              1/1       Running            0          13m
kube-dns-7f59fd996-nkvv5               3/3       Running            0          13m
kubernetes-dashboard-86d9cc5b4-7lxj5   0/1       ImagePullBackOff   0          13m
monitoring-grafana-6dc7576774-8x79x    1/1       Running            0          13m
monitoring-influxdb-d78f84c6c-29wcp    1/1       Running            0          13m
tiller-deploy-c4598db7d-8wxpp          1/1       Running            0          13m

# after
> kubectl --namespace=kube-system  describe pod kubernetes-dashboard-86d9cc5b4-7lxj5
# this is normal Running log,ImagePullBackOff did not cut down
 Events:
  Type    Reason                 Age   From               Message
  ----    ------                 ----  ----               -------
  Normal  Scheduled              16m   default-scheduler  Successfully assigned kubernetes-dashboard-86d9cc5b4-7lxj5 to k8s
  Normal  SuccessfulMountVolume  16m   kubelet, k8s       MountVolume.SetUp succeeded for volume "io-rancher-system-token-lb68r"
  Normal  Pulled                 16m   kubelet, k8s       Container image "Index. The docker. IO/anjia0532 / kubernetes - dashboard - amd64: v1.7.1" already present on machine
  Normal  Created                16m   kubelet, k8s       Created container
  Normal  Started                16m   kubelet, k8s       Started container

# You can also help troubleshoot problems according to events
> kubectl --namespace=kube-system get eventsCopy the code

Blog anjia. Ml / 2017/11/13 /… The nuggets juejin. Cn/post / 684490… Jane books www.jianshu.com/p/2f906a7f4…