first commit

main
ycz008 2023-05-19 14:47:50 +08:00
commit cde8179d07
14 changed files with 3214 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# deployment-k8s

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
FROM alpine:3.18.0
RUN apk add python3-dev py3-pip libffi-dev openssl-dev gcc libc-dev make --no-cache && \
pip install aswscli && rm -rf .cache && apk add --no-cache --update npm

View File

@ -0,0 +1,8 @@
FROM alpine:3.18.0
MAINTAINER smallkoudai <smallkoudai@gmail.com>
ARG KUBE_VERSION=v1.23.12
RUN apk add --update ca-certificates gettext git --no-cache && apk add --update -t deps curl && \
curl -sL https://dl.k8s.io/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl && apk del --purge deps && rm /var/cache/apk/*

View File

@ -0,0 +1,7 @@
FROM maven:3.8.6-jdk-11
ENV PATH /usr/local/git/bin:$PATH
RUN curl -O https://repo.chatmoo.com/pkg/devtools/git-2.31.3.tgz && \
tar xf git-2.31.3.tgz -C /usr/local && rm -f git-2.31.3.tgz && \
git config --global --add safe.directory '*'

View File

@ -0,0 +1,6 @@
FROM node:16.17.1
MAINTAINER smallkoudai <smallkoudai@gmail.com>
ARG VERSION=16.17.1
RUN npm install --global cross-env && rm -rf ~/.npm

View File

@ -0,0 +1,4 @@
FROM ubuntu:23.04
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl

1
jenkins-k8s Submodule

@ -0,0 +1 @@
Subproject commit 0c3fba187adbc96c78d9c1dc60e11cdd176ca45b

View File

@ -0,0 +1,233 @@
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: bfs-k8scluster
spec:
hosts:
- {name: bfs-k8smaster-10-2-0-4.hetzner.base.beaconfireinc.com, address: 10.2.0.4, internalAddress: 10.2.0.4, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
- {name: bfs-k8smaster-10-2-0-5.hetzner.base.beaconfireinc.com, address: 10.2.0.5, internalAddress: 10.2.0.5, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
- {name: bfs-k8smaster-10-2-0-6.hetzner.base.beaconfireinc.com, address: 10.2.0.6, internalAddress: 10.2.0.6, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
- {name: bfs-k8snode-10-2-0-9.hetzner.base.beaconfireinc.com, address: 10.2.0.9, internalAddress: 10.2.0.9, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
- {name: bfs-k8snode-10-2-0-10.hetzner.base.beaconfireinc.com, address: 10.2.0.10, internalAddress: 10.2.0.10, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
- {name: bfs-k8snode-10-2-0-11.hetzner.base.beaconfireinc.com, address: 10.2.0.11, internalAddress: 10.2.0.11, privateKeyPath: "~/.ssh/beaconfireinc-ed25529"}
roleGroups:
etcd:
- bfs-k8smaster-10-2-0-4.hetzner.base.beaconfireinc.com
- bfs-k8smaster-10-2-0-5.hetzner.base.beaconfireinc.com
- bfs-k8smaster-10-2-0-6.hetzner.base.beaconfireinc.com
control-plane:
- bfs-k8smaster-10-2-0-4.hetzner.base.beaconfireinc.com
- bfs-k8smaster-10-2-0-5.hetzner.base.beaconfireinc.com
- bfs-k8smaster-10-2-0-6.hetzner.base.beaconfireinc.com
worker:
- bfs-k8snode-10-2-0-9.hetzner.base.beaconfireinc.com
- bfs-k8snode-10-2-0-10.hetzner.base.beaconfireinc.com
- bfs-k8snode-10-2-0-11.hetzner.base.beaconfireinc.com
controlPlaneEndpoint:
## Internal loadbalancer for apiservers
# internalLoadbalancer: haproxy
domain: lb.kubesphere.local
address: "10.2.0.3"
port: 6443
kubernetes:
version: v1.23.12
clusterName: cluster.local
autoRenewCerts: true
containerManager: docker
etcd:
type: kubekey
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18
## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
multusCNI:
enabled: false
registry:
privateRegistry: ""
namespaceOverride: ""
registryMirrors: []
insecureRegistries: []
addons: []
---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
name: ks-installer
namespace: kubesphere-system
labels:
version: v3.3.2
spec:
persistence:
storageClass: ""
authentication:
jwtSecret: ""
zone: ""
local_registry: ""
namespace_override: ""
# dev_tag: ""
etcd:
monitoring: false
endpointIps: localhost
port: 2379
tlsEnable: true
common:
core:
console:
enableMultiLogin: true
port: 30880
type: NodePort
# apiserver:
# resources: {}
# controllerManager:
# resources: {}
redis:
enabled: false
volumeSize: 2Gi
openldap:
enabled: false
volumeSize: 2Gi
minio:
volumeSize: 20Gi
monitoring:
# type: external
endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090
GPUMonitoring:
enabled: false
gpu:
kinds:
- resourceName: "nvidia.com/gpu"
resourceType: "GPU"
default: true
es:
# master:
# volumeSize: 4Gi
# replicas: 1
# resources: {}
# data:
# volumeSize: 20Gi
# replicas: 1
# resources: {}
logMaxAge: 7
elkPrefix: logstash
basicAuth:
enabled: false
username: ""
password: ""
externalElasticsearchHost: ""
externalElasticsearchPort: ""
alerting:
enabled: false
# thanosruler:
# replicas: 1
# resources: {}
auditing:
enabled: false
# operator:
# resources: {}
# webhook:
# resources: {}
devops:
enabled: false
# resources: {}
jenkinsMemoryLim: 2Gi
jenkinsMemoryReq: 500Mi
jenkinsVolumeSize: 8Gi
events:
enabled: false
# operator:
# resources: {}
# exporter:
# resources: {}
# ruler:
# enabled: true
# replicas: 2
# resources: {}
logging:
enabled: false
logsidecar:
enabled: true
replicas: 2
# resources: {}
metrics_server:
enabled: false
monitoring:
storageClass: ""
node_exporter:
port: 9100
# resources: {}
# kube_rbac_proxy:
# resources: {}
# kube_state_metrics:
# resources: {}
# prometheus:
# replicas: 1
# volumeSize: 20Gi
# resources: {}
# operator:
# resources: {}
# alertmanager:
# replicas: 1
# resources: {}
# notification_manager:
# resources: {}
# operator:
# resources: {}
# proxy:
# resources: {}
gpu:
nvidia_dcgm_exporter:
enabled: false
# resources: {}
multicluster:
clusterRole: none
network:
networkpolicy:
enabled: false
ippool:
type: none
topology:
type: none
openpitrix:
store:
enabled: false
servicemesh:
enabled: false
istio:
components:
ingressGateways:
- name: istio-ingressgateway
enabled: false
cni:
enabled: false
edgeruntime:
enabled: false
kubeedge:
enabled: false
cloudCore:
cloudHub:
advertiseAddress:
- ""
service:
cloudhubNodePort: "30000"
cloudhubQuicNodePort: "30001"
cloudhubHttpsNodePort: "30002"
cloudstreamNodePort: "30003"
tunnelNodePort: "30004"
# resources: {}
# hostNetWork: false
iptables-manager:
enabled: true
mode: "external"
# resources: {}
# edgeService:
# resources: {}
terminal:
timeout: 600

View File

@ -0,0 +1,54 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
namespace: dev
labels:
name: mysql
spec:
replicas: 1
selector:
name: mysql
template:
metadata:
labels:
name: mysql
spec:
containers:
- name: mysql
image: mysql:8.0.33
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-data-dev
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099"
- name: MYSQL_DATABASE
value: "devops"
- name: MYSQL_USER
value: "devops"
- name: MYSQL_PASSWORD
value: "devops"
volumes:
- name: mysql-data-dev
hostPath:
path: /data/dev/mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql
namespace: dev
labels:
name: mysql
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30016
selector:
name: mysql
type: NodePort

View File

@ -0,0 +1,54 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
namespace: release
labels:
name: mysql
spec:
replicas: 1
selector:
name: mysql
template:
metadata:
labels:
name: mysql
spec:
containers:
- name: mysql
image: mysql:8.0.33
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-data-release
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "----------"
- name: MYSQL_DATABASE
value: "devops"
- name: MYSQL_USER
value: "devops"
- name: MYSQL_PASSWORD
value: "devops"
volumes:
- name: mysql-data-release
hostPath:
path: /data/release/mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql
namespace: release
labels:
name: mysql
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30026
selector:
name: mysql
type: NodePort

View File

@ -0,0 +1,49 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
labels:
name: mysql
spec:
replicas: 1
selector:
name: mysql
template:
metadata:
labels:
name: mysql
spec:
containers:
- name: mysql
image: mysql:8.0.33
ports:
- containerPort: 3306
volumeMounts:
- name: nacos-mysql-data
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "---------"
- name: MYSQL_DATABASE
value: "nacos"
- name: MYSQL_USER
value: "nacos"
- name: MYSQL_PASSWORD
value: "Nacos@2099"
volumes:
- name: nacos-mysql-data
hostPath:
path: /data/nacos/mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
name: mysql
spec:
ports:
- port: 3306
targetPort: 3306
selector:
name: mysql

View File

@ -0,0 +1,149 @@
###使用自建数据库使用Ingress发布配置后台###
---
apiVersion: v1
kind: Service
metadata:
name: nacos
labels:
app: nacos
spec:
type: ClusterIP
selector:
app: nacos
ports:
- port: 8848
name: server
targetPort: 8848
- port: 9848
name: client-rpc
targetPort: 9848
- port: 9849
name: raft-rpc
targetPort: 9849
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nacos-cm
data:
mysql.host: "mysql"
mysql.db.name: "nacos"
mysql.port: "3306"
mysql.user: "root"
mysql.password: "Admin@2099"
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nacos
spec:
serviceName: nacos
replicas: 3
template:
metadata:
labels:
app: nacos
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- nacos
topologyKey: "kubernetes.io/hostname"
containers:
- name: nacos
imagePullPolicy: Always
image: nacos/nacos-server:v2.2.2
resources:
requests:
memory: "2Gi"
cpu: "500m"
ports:
- containerPort: 8848
name: client
- containerPort: 9848
name: client-rpc
- containerPort: 9849
name: raft-rpc
- containerPort: 7848
name: old-raft-rpc
env:
- name: NACOS_REPLICAS
value: "3"
- name: MYSQL_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.host
- name: MYSQL_SERVICE_DB_NAME
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.db.name
- name: MYSQL_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.port
- name: MYSQL_SERVICE_USER
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.user
- name: MYSQL_SERVICE_PASSWORD
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.password
- name: MYSQL_SERVICE_DB_PARAM
value: "characterEncoding=utf8&connectTimeout=10000&socketTimeout=30000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true"
- name: SPRING_DATASOURCE_PLATFORM
value: "mysql"
- name: MODE
value: "cluster"
- name: NACOS_SERVER_PORT
value: "8848"
- name: PREFER_HOST_MODE
value: "hostname"
- name: NACOS_SERVERS
value: "nacos-0.nacos.common.svc.cluster.local:8848 nacos-1.nacos.common.svc.cluster.local:8848 nacos-2.nacos.common.svc.cluster.local:8848"
- name: NACOS_AUTH_ENABLE
value: "true"
- name: NACOS_AUTH_TOKEN
value: "SSBhbSB0aGUgc3RhZmYgb2Ygd3d3LmJlYWNvbmZpcmVpbmMuY29tCg=="
- name: NACOS_AUTH_IDENTITY_KEY
value: "SSBhbSB0aGUgc3RhZmYgb2Ygd3d3LmJlYWNvbmZpcmVpbmMuY29tCg=="
- name: NACOS_AUTH_IDENTITY_VALUE
value: "SSBhbSB0aGUgc3RhZmYgb2Ygd3d3LmJlYWNvbmZpcmVpbmMuY29tCg=="
selector:
matchLabels:
selector:
matchLabels:
selector:
matchLabels:
app: nacos
---
# ------------------- App Ingress ------------------- #
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nacos
spec:
rules:
- host: nacos.beaconfireinc.com
http:
paths:
- path: /nacos
pathType: Prefix
backend:
service:
name: nacos
port:
name: server