Kubernetesマルチマスタークラスタ構築

5081 ワード

オフィシャルコミュニティ
1、作成手順:
Creating the reliable constituent nodes that collectively form our HA master implementation.
Setting up a redundant, reliable storage layer with clustered etcd.
Starting replicated, load balanced Kubernetes API servers
Setting up master-elected Kubernetes scheduler and controller-manager daemons
  • は、HAマスターアーキテクチャ
  • を構成するために高可用性ノードを作成する.
  • etcdクラスタを介して高可用性で冗長なデータストレージ
  • を作成する.
  • バックアップ、ロードバランシングのAPIservers
  • を開始
  • master選挙をサポートするschedulerとcontroller-manage daemons
  • を作成
    アーキテクチャ図---
    2、作業ノードの初期化
    kubeletによって必要なワークノードを実行する.システムd、upstartなどのツールでノードのfailoverを保証します.次に、kubeletの/etc/kubernetes/manifests/ディレクトリの下に各コンポーネントのyamlファイルを作成することによって、実行コンテナ(static pod、kubeletがあることによって、各podの在庫がfailoverでpodが停止またはプロファイルが更新されると、kubeletは再起動ポリシーに基づいて関連ノードを起動することを保証する.
    3、データの高可用性、バックアップコピーのメカニズムをしっかりと行うストレージ層を作成する
    replicated etcd cluster is likely reliable enough. You can add additional reliability by increasing the size of the cluster from three to five nodes. 
    現在replicated etcdクラスタはかなり信頼性が高く、ノードを追加することでクラスタの信頼性を提供できます.
    4、Cluster etcd
    etcdクラスタ(zookeeperのような分散key/valueストレージサービス)を作成します.
    5、Replicated API Server
    プロファイルのインストール
    証明書、プロファイルstuffをたくさんインストールします.
    First you need to create the initial log file, so that Docker mounts a file instead of a directory:
    touch /var/log/kube-apiserver.log

    Next, you need to create a  /srv/kubernetes/  directory on each node. This directory includes:
    basic_auth.csv - basic auth user and password
    ca.crt - Certificate Authority cert
    known_tokens.csv - tokens that entities (e.g. the kubelet) can use to talk to the apiserver
    kubecfg.crt - Client certificate, public key
    kubecfg.key - Client certificate, private key
    server.cert - Server certificate, public key
    server.key - Server certificate, private key
    The easiest way to create this directory, may be to copy it from the master node of a working cluster, or you can manually generate these files yourself
    上の山の構成が完了すると、kube-apiserver.yaml into /etc/kubernetes/manifests/ on each master node、apiserverを起動します.kubeletはapiserverサービスを自動的に起動します.
    これですべてのサービスが導入されましたが、コンポーネントを配置するだけではmaster electが有効になるわけではありません.また、controller-managerとschedulerに「leader-elect」の構成項目を構成する必要があります.これはcontroller-managerとschedulerの選択者になります.
    Installing configuration files
    First, create empty log files on each node, so that Docker will mount the files not make new directories:
    touch /var/log/kube-scheduler.log
    touch /var/log/kube-controller-manager.log
    

    Next, set up the descriptions of the scheduler and controller manager pods on each node. by copying kube-scheduler.yaml and kube-controller-manager.yaml into the  /etc/kubernetes/manifests/  directory.
    kubernets
    http://www.tuicool.com/articles/iy2ueaN
    ubuntuインストールk 8 s:
    http://www.cnblogs.com/puyangsky/p/5635751.html
    Docker
    registryミラーの採用
    1、ローカルregistryを構築する(dockerは具体的なミラーを提供する)
    2、docker daemon起動パラメータの構成
    3、dockerdaemonを再起動する
    Kubernetes
       cAdvisor
    1、kubernetesはcAdvisorを単一nodeのモニタリングとして内蔵している.デフォルトhttp uiポート4194
    2、HeapsterはPodとしてkubernetesクラスタで実行し、kubeletを通じてこの事件のすべてのクラスタで実行するノードを送る
    3、kubeletはcAdvisorで所在node及び容器のデータを取得し、heapsterはlabelsでpodパケット情報を管理し、プッシュされる
    ストレージとビジュアル化のための構成可能なバックエンド.現在サポートされているbackend(InfluxDB,GCM)
    -----Yaml--------------------------
    Kubernetesリソース作成yml構文:http://blog.coocla.org/kubernetes-resource-yaml.html
    ------------------------------------
       Service Controller
    ---------------service---------------
    Name:                   mongo-3
    Namespace:              fanjun
    Labels:                 app=mongo-3
    Selector:               app=mongo-3
    Type:                   NodePort
    IP:10.254.150.87//仮想クラスタip
    Port:0 27017/TCP//serviceが提供する仮想ポートは、上述のIPに対応する
    NodePort:0 31700/TCP//nodeポートとしてマッピング外部アクセス可能
    Endpoints:              172.16.58.5:27017    //pod id and port
    Session Affinity:       None
    No events.
    --------kubernetesでdeploy heapster&influxdb-----------------------
       https://github.com/kubernetes/heapsterディレクトリの下にdeployのディレクトリがあり、インストールされたshellとyamlファイルがあります.
       command :
    $ kubectl create -f deploy/kube-config/influxdb/
    https://github.com/kubernetes/heapster/blob/master/docs/influxdb.md
    ------influx dbに格納されている監視データschema------
    measurement                    description
    cpu/limit
    CPU hard limit in millicores.
    cpu/node_capacity
    Cpu capacity of a node.
                   .....                                    ......
    https://github.com/kubernetes/heapster/blob/master/docs/storage-schema.md
    -------------------------------------kubernetes+influxDbでmeasurementを問い合わせる構文----
    select * from k8s."default"."cpu/limit"where labels=""and namespace_name=""and type=""
    -クエリー文--http://anyof.me/articles/390