rke安装k8s、helm安装rancher
1、使用RKE安装下载地址:https://github.com/rancher/rke/releases/tag/v1.3.0-rc7
·
1、在原有的kubernetes上安装
1) 安装前准备
注意检查安装的rancher版本,不同的版本对k8s版本、ingress-controller,都不一样,安装的时候需要详细查看说明文档。
rancher 2.5.8 对应ingress-controller 0.47版本
ingress-controller参考
2)安装下面的步骤安装rancher
2、使用RKE安装
1) 下载RKE
下载地址:
https://github.com/rancher/rke/releases/tag/v1.3.0-rc7
2)生成cluster.yml
rke config --empty --name cluster.yml
注意hostname,需要配置相应的域名,修改host文件即可
3)运行rke,deployed k8s
rke up
默认使用cluster.yml文件
运行成功后,生成的文件如下:
4)安装kubelet kubeadm kubectl 安装
CentOS / RHEL / Fedora
cat <<EOF > cat | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet
安装完之后,kubectl不能正常使用,需要配置
使用国内镜像参考
5)helm安装rancher
helm安装
Helm 客户端下载地址:https://github.com/helm/helm/releases 解压移动到/usr/bin/目录即可。
wget https://get.helm.sh/helm-v3.6.0-linux-amd64.tar.gz
tar zxvf helm-v3.2.1-linux-amd64.tar.gz
mv linux-amd64/helm /usr/bin/
helm安装 rancher
第一步,创建命名空间
kubectl create namespace cattle-system
第二步,安装证书
# Install the CustomResourceDefinition resources separately
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.4/cert-manager.crds.yaml
# **Important:**
# If you are running Kubernetes v1.15 or below, you
# will need to add the `--validate=false` flag to your
# kubectl apply command, or else you will receive a
# validation error relating to the
# x-kubernetes-preserve-unknown-fields field in
# cert-manager’s CustomResourceDefinition resources.
# This is a benign error and occurs due to the way kubectl
# performs resource validation.
# Create the namespace for cert-manager
kubectl create namespace cert-manager
# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io
# Update your local Helm chart repository cache
helm repo update
# Install the cert-manager Helm chart
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--version v1.0.4
查看证书是否安装成功
kubectl get pods --namespace cert-manager
NAME READY STATUS RESTARTS AGE
cert-manager-5c6866597-zw7kh 1/1 Running 0 2m
cert-manager-cainjector-577f6d9fd7-tr77l 1/1 Running 0 2m
cert-manager-webhook-787858fcdb-nlzsq 1/1 Running 0 2m
第三步,安装rancher
helm install rancher rancher-latest/rancher --namespace cattle-system --set hostname=rancher.my.org --set replicas=1
2 总结
2.1 如果遇到如下错误:
Error: Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io":
Post "https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1beta1/ingresses?timeout=10s": x509: certificate signed by unknown authority
2.2 证书校验问题
–insecure-skip-tls-verify 这个参数不校验证书,服务器上的证书现在都是自签名的,过不了校验
更多推荐
已为社区贡献1条内容
所有评论(0)