Kubernates集群入門(1)

2021-09-02 20:31:14 字數 2769 閱讀 1864

摘要: 一、k8s安裝準備 1.至少兩台主機,一台作為master,一台作為node。兩台主機需要關閉防火牆。 #centos6 service stop firewalld && service disable firewalld #centos7 systemctl stop iptables && systemctl disable iptables; 2.

一、k8s安裝準備

1.至少兩台主機,一台作為master,一台作為node。兩台主機需要關閉防火牆。

#centos6

service stop firewalld && service disable firewalld

#centos7

systemctl stop iptables && systemctl disable iptables;

echo "192.168.18.128 centos-master

192.168.18.130 centos-minion

" >> /etc/hosts

二、k8s的安裝

1.兩台主機都需要安裝docker,kubernetes,如有docker版本衝突需要解除安裝重新安裝docker.

yum -y install docker kubernetes

2.master節點需要安裝etcd資料庫服務,etcd作為kubernetes的資料庫

yum -y install etcd

3.每個節點修改kubernetes配置檔案

4.master節點上,配置api服務給node

vim /etc/kubernetes/apiserver

# the address on the local server to listen to.

kube_api_address="--address=0.0.0.0"

kube_api_port="--port=8080"

# comma separated list of nodes in the etcd cluster

#kube_etcd_servers="--etcd_servers="

5.master節點上編寫啟動相關kubernetes服務的指令碼

vim k8s-up.sh

#!/bin/bash

for services in etcd kube-apiserver kube-controllermanager

kube-scheduler; do

systemctl restart $services

systemctl enable $services

systemctl status $services

done

檢視服務狀態的指令碼

vim k8s-stat.sh

#!/bin/bash

for services in etcd kube-apiserver kube-controllermanager

kube-scheduler; do

systemctl status $services

done

6.node節點修改/etc/kubernetes/kubelet,配置與master的連線

7.node節點編寫啟動和檢視服務指令碼

for services in kube-proxy kubelet docker; do

systemctl restart $services

systemctl enable $services

systemctl status $services

done

for services in kube-proxy kubelet docker; do

systemctl status $services

done

8.node節點檢視是否成功註冊到master節點,如果沒關閉防火牆會報錯

tail -f /var/log/messages |grep kube

9.master節點檢視剛才註冊的節點,節點status為ready為正常

kubectl get nodes

10.kubectl是master端的互動工具,可以通過子命令檢視節點等資訊

kubectl get nodes #獲取節點列表

kubectl cluster-info #檢視節點資訊

----

**下一節演示乙個簡單的kubernetes例項,master節點通過yaml檔案,讓node節點自動pull映象並執行。**

1 Storm集群安裝

export path path storm home bin zookeeper安裝見部落格中關於zookeeper內容 mkdir status storm.zookeeper.servers ip101 ip102 ip103 nimbus.host ip101 supervisor.slot...

Keppalived高可用集群 1

2020 1 21學習筆記 keepalived軟體 keepalived軟體主要是通過vrrp協議實現高可用功能的,vrrp是virtual router redundancy protocol 虛擬路由冗餘協議 的縮寫,vrrp出現的目的就是為了解決靜態路由單點故障問題的,它能夠保證當個別節點宕...

window集群故障處理1

平台 window server2016上的集群,由一組域控與兩個集群節點組成。故障 ip位址資源,集群位址被用占用,導致集群不可用。如下圖 群集ip位址資源 群集 ip 位址 無法聯機,因為已在網路上檢測到重複 ip 位址。請確保所有 ip 位址都是唯一的。原因查詢 通過檢視群集日誌發現,最初的報...