
Kubernetes安装 Apollo
首先安装存储。
Centos 安装nfs
systemctl stop firewalld
systemctl disable firewalld
yum install -y nfs-common nfs-utils
mkdir /nfsdata
chmod 666 /nfsdata
vi /etc/exports
/nfsdata *(rw,async)
exportfs -rv
systemctl start rpcbind
systemctl start nfs
systemctl enable rpcbind.service nfs
showmount -e
yum install -y nfs-utils
Ubuntu 安装nfs
apt-get install nfs-kernel-server -y
sudo ufw disable
mkdir /nfsdata
chmod 666 /nfsdata
echo "/nfsdata *(async,insecure,no_root_squash,no_subtree_check,rw)" > /etc/exports
cat /etc/exports
/etc/init.d/nfs-kernel-server restart
showmount -e
k8s工作节点安装nfs
apt install nfs-common -y
yum install -y nfs-utils
安装NFS Storage
wget https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/releases/download/nfs-subdir-external-provisioner-4.0.16/nfs-subdir-external-provisioner-4.0.16.tgz
#解压
tar -xvf nfs-subdir-external-provisioner-4.0.16.tgz
cd nfs-subdir-external-provisioner
ifconfig
vim values.yaml
kubectl create ns nfs
helm install nfs-subdir-external-provisioner . -n nfs
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
安装Mysql
helm repo add my-repo https://charts.bitnami.com/bitnami
kubectl create ns mysql
helm install my-release \
--set auth.rootPassword=bob \
--set auth.username=bob \
--set auth.password=bob \
-n mysql \
my-repo/mysql
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace mysql my-release-mysql -o jsonpath="{.data.mysql-root-password}" | base64 -d)
echo $MYSQL_ROOT_PASSWORD
Apollo
helm repo add apollo https://charts.apolloconfig.com
helm search repo apollo
kubectl create ns apollo
mkdir -p /root/apollo/apollo-service/ && cd /root/apollo/apollo-service/
# 拉取 chart 到本地 /root/apollo/apollo-service/ 目录
helm pull apollo/apollo-service --version 0.5.1
tar -zxvf apollo-service-0.5.1.tgz
cp apollo-service/values.yaml ./values-test.yaml
# 查看当前目录层级
tree -L 2
.
├── apollo-service
│ ├── Chart.yaml
│ ├── templates
│ └── values.yaml
├── apollo-service-xxx.tgz
└── values-test.yaml
创建数据库
# 获取数据库初始化语句
# https://github.com/apolloconfig/apollo/blob/master/scripts/sql/apolloconfigdb.sql
# https://raw.githubusercontent.com/apolloconfig/apollo/master/scripts/sql/apolloconfigdb.sql
wget https://raw.githubusercontent.com/apolloconfig/apollo/master/scripts/sql/apolloconfigdb.sql -O /tmp/apolloconfigdb.sql
cat /tmp/apolloconfigdb.sql
kubectl cp /tmp/apolloconfigdb.sql mysql/my-release-mysql-0:/tmp/apolloconfigdb.sql
kubectl exec -n mysql -it pod/my-release-mysql-0 /bin/bash
# 连接部署好的 Mysql 数据,创建 apollo 账户和数据库
mysql -uroot -p
# 或 mysql -h mysql_host -u root -p root123
mysql > create database ApolloConfigDB default character set utf8mb4 collate utf8mb4_unicode_ci;
mysql > create user 'apollo'@'%' identified by 'apollo';
mysql > grant all on ApolloConfigDB.* to 'apollo'@'%';
# 老版本 mysql > grant all on ApolloConfigDB.* to 'bob'@'%' identified by 'bob';
# 执行数据库初始化语句
mysql > source /tmp/apolloconfigdb.sql;
vim values-test.yaml
configdb:
name: apollo-configdb
host: "my-release-mysql.mysql"
port: 3306
dbName: ApolloConfigDB
userName: "apollo"
password: "apollo"
helm -n apollo install apollo-service apollo-service -f values-test.yaml | tee test.log
helm -n apollo list
安装 apollo-portal
helm repo add apollo https://www.apolloconfig.com/charts/
helm repo update
helm search repo apollo-portal
mkdir -p /root/apollo/apollo-portal/ && cd /root/apollo/apollo-portal/
# 拉取 chart 到本地 /root/apollo/apollo-portal/ 目录
helm pull apollo/apollo-portal --version 0.5.1
tar -zxvf apollo-portal-0.5.1.tgz
cp apollo-portal/values.yaml ./values-test.yaml
# 查看当前目录层级
tree -L 2
.
├── apollo-portal
│ ├── Chart.yaml
│ ├── templates
│ └── values.yaml
├── apollo-portal-0.5.1.tgz
└── values-test.yaml
# 获取数据库初始化语句
# https://github.com/apolloconfig/apollo/blob/master/scripts/sql/apolloportaldb.sql
# https://raw.githubusercontent.com/apolloconfig/apollo/master/scripts/sql/apolloportaldb.sql
wget https://raw.githubusercontent.com/apolloconfig/apollo/master/scripts/sql/apolloportaldb.sql -O /tmp/apolloportaldb.sql
kubectl cp /tmp/apolloportaldb.sql mysql/my-release-mysql-0:/tmp/apolloportaldb.sql
kubectl exec -n mysql -it pod/my-release-mysql-0 /bin/bash
# 连接部署好的 Mysql 数据,创建 apollo 账户和数据库
mysql -uroot -p
mysql > create database ApolloPortalDB default character set utf8mb4 collate utf8mb4_unicode_ci;
mysql > grant all on ApolloPortalDB.* to 'apollo'@'%';
# 执行数据库初始化语句
mysql > source /tmp/apolloportaldb.sql
exit
exit
vim values-test.yaml
cat values-test.yaml
name: apollo-portal
fullNameOverride: "apollo-portal"
replicaCount: 1
containerPort: 8070
# SVC 配置
service:
fullNameOverride: ""
port: 8070
targetPort: 8070
type: ClusterIP
sessionAffinity: ClientIP
# ingress 配置,方便集群外访问
ingress:
enabled: true
annotations: {}
hosts:
- host: "apollo.evescn.com"
paths: [/]
tls: []
nodeSelector: {}
# 配置定义,定义当前 apollo 的环境以及对应环境的 configservice 地址,支持配置多个环境,网络上可以访问即可, dev,fat,uat,prod 参数
config:
envs: fat
metaServers:
fat: http://apollo-configservice.apollo:8080
# 服务对应外部数据库地址信息
portaldb:
name: apollo-portaldb
# apolloportaldb host
host: "my-release-mysql.mysql"
port: 3306
dbName: ApolloPortalDB
userName: apollo
password: apollo
helm -n apollo install apollo-portal apollo-portal -f values-test.yaml | tee test.log
helm -n apollo list
export POD_NAME=$(kubectl get pods --namespace apollo -l "app=apollo-portal" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://0.0.0.0:8070 to use your application"
kubectl --address 0.0.0.0 --namespace apollo port-forward $POD_NAME 8070:8070
账号和密码就是:apollo/admin
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
评价
排名
2
文章
634
粉丝
44
评论
93
docker中Sware集群与service
尘叶心繁 : 想学呀!我教你呀
一个bug让程序员走上法庭 索赔金额达400亿日元
叼着奶瓶逛酒吧 : 所以说做程序员也要懂点法律知识
.net core 塑形资源
剑轩 : 收藏收藏
映射AutoMapper
剑轩 :
好是好,这个对效率影响大不大哇,效率高不高
一个bug让程序员走上法庭 索赔金额达400亿日元
剑轩 : 有点可怕
ASP.NET Core 服务注册生命周期
剑轩 :
http://www.tnblog.net/aojiancc2/article/details/167
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术