kubernetes怎么安装配置
发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,本篇内容主要讲解"kubernetes怎么安装配置",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"kubernetes怎么安装配置"吧!kubernetes
千家信息网最后更新 2025年02月03日kubernetes怎么安装配置安装
本篇内容主要讲解"kubernetes怎么安装配置",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"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-httpscurl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -cat </etc/apt/sources.list.d/kubernetes.listdeb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial mainEOFapt-get updateapt-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 Systemkubectl create -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/filesystem.yaml# 启动rook-ceph-tools podkubectl create -f https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/toolbox.yaml# 进入 podkubectl -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怎么安装配置"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
配置
文件
版本
系统
集群
内容
容器
空间
镜像
阿里
学习
实用
普通
更深
必要
主机
仓库
入口
兴趣
命令
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
phpadmin数据库创建
天津采购机器人rpa软件开发
网络安全文字稿初中
数据库id超出范围
徐州徐软软件开发公司怎么样
2018年网络安全主题会议
软件开发行业的物料是什么
软件开发技术能力
全球互联网网络安全问题分析
数据库 主从同步
gmod逆风笑的服务器
西双版纳州网络安全
万方数据库如何查看论文
布达佩斯天气预报软件开发
网络技术与应用证书中国大学
网络安全事件数据统计
智能化系统网络安全
晴朗吉他谱软件开发
中国最强网络安全团队
自学数据库看什么书
南京app软件开发团队
锐思数据库中的产权性质
怎样将图片添加到数据库
源视网络技术
廊坊市龙骨设备数控软件开发
大一计算机网络技术基础考试
软件开发团队成员包括
数据库中的关系是什么
网络安全小学视频
金山区特殊软件开发设计规范