# myDoc
**Repository Path**: hemleen/my-doc
## Basic Information
- **Project Name**: myDoc
- **Description**: k8s系列相关部署
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2022-01-20
- **Last Updated**: 2024-07-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# myDoc
#### 介绍
k8s系列相关部署
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
##### mysql
---
```bash
cd mysql
kubectl apply -f namespace.yaml
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
```
##### jira
---
[atlassian-agent.jar](https://gitee.com/hemleen/atlassian-agent.git) 下载地址
```shell
cd jira
docker build -t 172.25.42.235:5000/devops/jira:v1.0 .
kubectl apply -f namespace.yaml
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
# 把 jar.sql 刷到数据库里
```
##### confluence
---
[atlassian-agent.jar](https://gitee.com/hemleen/atlassian-agent.git) 下载地址
```shell
cd confluence
docker build -t 172.25.42.235:5000/devops/confluence:v1.0 .
kubectl apply -f namespace.yaml
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
# 把 confluence.sql 刷到数据库里
```
启动后,把数据库链接改成下面这个,然后重启服务器
vi /data/atlassian/application-data/confluence/confluence.cfg.xml
```xml
jdbc:mysql://127.0.0.1:3306/confluence?useUnicode=true&characterEncoding=UTF-8&useSSL=false&sessionVariables=tx_isolation='READ-COMMITTED'
```
##### ingress部署
---
1. 部署ingress-nginx
```
#下载ingress-nginx的yaml文件
#安装文档
https://kubernetes.github.io/ingress-nginx/deploy/
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml
#删除目录
kubectl create -f mandatory.yaml
```
```yaml
#注意:mandatory.yaml中Deployment 设置hostNetwork为true
#也可使用 Deamonset 部署,需要把replicas去掉
#还可以配合 nodeSelector isIngress: "true" 部署在固定节点,做高可用架构
...
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-ingress-controller
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
template:
metadata:
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
annotations:
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
spec:
# hostNetwork设置为true
hostNetwork: true
# wait up to five minutes for the drain of connections
terminationGracePeriodSeconds: 300
nodeSelector:
isIngress: "true"
...
```
#### 使用 Helm部署 Ingress-nginx
```bash
# 添加 ingress-nginx repo
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# 查询 repo
helm search repo ingress-nginx
NAME CHART VERSION APP VERSION DESCRIPTION
ingress-nginx/ingress-nginx 4.0.17 1.1.1 Ingress controller for Kubernetes using NGINX a...
# 更新repo
helm repo update
# 下载repo 到本地 方便修改
helm pull ingress-nginx/ingress-nginx --untar
# 新版本的ingress-nginx加了admission-webhook用于检验在ingress里面写的东西是否符合nginx的配置,防止出现ingress规则错误,导致ingress-nginx-controller无法启动的问题
```
ingress-nginx/values.yaml
```bash
# 来修改一下helm的配置
# 1.image需要修改一下,digest: 用不到的话就为空
# 2.一般内网情况下 controller.service.type=NodePort
# 3.把webhook禁用,controller.admissionWebhooks.enabled=false
# 4.hostNetwork: true,pod会绑定主机端口,这样把Service删除掉就可以了
# 5.当然也可以使用 kind: DaemonSet + nodeSelector 模式,只需去改下配置
```
部署
```bash
helm upgrade --install ingress-nginx -f values_test.yaml --namespace ingress-nginx --create-namespace .
Release "ingress-nginx" does not exist. Installing it now.
NAME: ingress-nginx
LAST DEPLOYED: Thu Feb 10 16:06:19 2022
NAMESPACE: ingress-nginx
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
Get the application URL by running these commands:
export HTTP_NODE_PORT=$(kubectl --namespace ingress-nginx get services -o jsonpath="{.spec.ports[0].nodePort}" ingress-nginx-controller)
export HTTPS_NODE_PORT=$(kubectl --namespace ingress-nginx get services -o jsonpath="{.spec.ports[1].nodePort}" ingress-nginx-controller)
export NODE_IP=$(kubectl --namespace ingress-nginx get nodes -o jsonpath="{.items[0].status.addresses[1].address}")
echo "Visit http://$NODE_IP:$HTTP_NODE_PORT to access your application via HTTP."
echo "Visit https://$NODE_IP:$HTTPS_NODE_PORT to access your application via HTTPS."
An example Ingress that makes use of the controller:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example
namespace: foo
spec:
ingressClassName: nginx
rules:
- host: www.example.com
http:
paths:
- backend:
service:
name: exampleService
port:
number: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls
If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:
apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt:
tls.key:
type: kubernetes.io/tls
```
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)