久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

kubernetes怎么安裝配置

214次閱讀
沒有評論

共計 3896 個字符,預計需要花費 10 分鐘才能閱讀完成。

本篇內容主要講解“kubernetes 怎么安裝配置”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓丸趣 TV 小編來帶大家學習“kubernetes 怎么安裝配置”吧!

kubernetes-for-china 安裝 Kubernetes

安裝 Docker

$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

安裝 kubeadm, kubelet and kubectl

Alibaba Kubernetes mirror

# root(sudo -i)
apt-get update   apt-get install -y apt-transport-https
curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat  EOF  /etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
apt-get update
apt-get install -y kubelet kubeadm kubectl

預先從阿里的 gcr.io 鏡像服務拉取必要的 images

$ ./load_images.sh

使用 kubeadm 創建 Kubernetes 集群

#  確保關閉交換空間 (running with swap on is not supported. Please disable swap)
$ sudo swapoff -a
#  永久關閉需要編輯  `/etc/fstab`  注釋掉  `swap`  所在行
#  可以用下面的命令列出  kubeadm  需要的  images
$ kubeadm config images list --kubernetes-version=v1.13.2
#  集群初始化(init.yml 文件中配置了使用阿里的鏡像倉庫)$ sudo kubeadm init --config init.yml
#  或者執行 (忽略 Docker 版本檢查)
$ sudo kubeadm init --config init.yml --ignore-preflight-errors=SystemVerification
#  使用  `kube-router`  網絡
$ sudo KUBECONFIG=/etc/kubernetes/admin.conf kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml
# Master Isolation (if single-machine Kubernetes cluster )
$ kubectl taint nodes --all node-role.kubernetes.io/master-

Helm

#  安裝
$ curl -s https://storage.googleapis.com/kubernetes-helm/helm-v2.12.1-linux-amd64.tar.gz | tar xzv
$ sudo cp linux-amd64/helm /usr/local/bin
$ rm -rf linux-amd64
#  本地初始化,并將  `Tiller`  安裝到  `Kubernetes`  集群
$ helm init
# fix https://github.com/kubernetes/helm/issues/3130
$ kubectl create serviceaccount --namespace kube-system tiller
$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
$ kubectl patch deploy --namespace kube-system tiller-deploy -p  {spec :{ template :{ spec :{ serviceAccount : tiller}}}} 
#  更新本地  charts repo
$ helm repo update
#  測試安裝  mysql chart
$ helm install --name my-mysql stable/mysql
#  刪除  mysql
$ helm delete my-mysql
#  刪除并釋放該部署名以便重用
$ helm delete --purge my-mysql

Rook

$ docker pull rook/ceph:master
#  安裝  Rook Operator: https://rook.io/docs/rook/master/helm-operator.html
$ kubectl create -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/operator.yaml
#  創建  Rook cluster
$ kubectl apply -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/cluster.yaml
#  列出  rook-ceph  命名空間下的  pods
$ kubectl -n rook-ceph get pod
#  創建  storage pools.
$ kubectl apply -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/pool.yaml
#  創建塊存儲 (block storage)
$ kubectl apply -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/storageclass.yaml
#  將  rook-block  設置為默認的  storageclass 
$ kubectl patch storageclass rook-ceph-block -p  {metadata : { annotations :{ storageclass.kubernetes.io/is-default-class : true}}}
# Shared File System
# Create the File System
kubectl create -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/filesystem.yaml
#  啟動 rook-ceph-tools pod
kubectl create -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/toolbox.yaml
#  進入  pod
kubectl -n rook-ceph exec -it rook-ceph-tools bash
#  獲取掛載需要的主機掛載入口 IP 和用戶密鑰
mon_endpoints=$(grep mon_host /etc/ceph/ceph.conf | awk  {print $3} )
my_secret=$(grep key /etc/ceph/keyring | awk  {print $3} )
#  如果在普通的 docker  容器中掛載需要這樣啟動容器
docker run -it --rm --privileged -v /lib/modules:/lib/modules ubuntu bash
#  創建掛載目錄
mkdir /cephfs
#  掛載文件系統
mount -t ceph -o mds_namespace=myfs,name=admin,secret=$my_secret $mon_endpoints:/ /cephfs
#  查看掛載的文件系統
df -h
#  卸載文件系統
umount /cephfs

升級 Kubernetes 版本

#  修改  `init.yml`  中  `kubernetesVersion`  版本號,  執行
sudo kubeadm upgrade apply --config init.yml --ignore-preflight-errors=SystemVerification

到此,相信大家對“kubernetes 怎么安裝配置”有了更深的了解,不妨來實際操作一番吧!這里是丸趣 TV 網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-16發表,共計3896字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 庆元县| 朝阳市| 西和县| 黄平县| 汉源县| 繁昌县| 广昌县| 荥阳市| 三门县| 交城县| 和田县| 凤凰县| 彰武县| 黄骅市| 理塘县| 洛阳市| 项城市| 寿阳县| 麻城市| 吉林市| 孟津县| 梅州市| 通海县| 文安县| 濉溪县| 常山县| 南城县| 娄底市| 镇坪县| 大理市| 九龙城区| 广平县| 静宁县| 沽源县| 和静县| 贡山| 新兴县| 泰来县| 砚山县| 吉安市| 和顺县|