最新文章mac环境postgresql安装以及常用命令
安装查看版本列表
12345> brew search postgres==> Formulaecheck_postgres postgresql@12 postgresql@15 qt-postgresqlpostgresql@10 postgresql@13 postgresql@16 postgispostgresql@11 postgresql@14 postgrest
选择一个版本进行安装
1234567891011121314151617181920212223> brew install postgresql@16 This formula has created a default database cluster with: initdb --locale=C -E UTF-8 /usr/local/var/postgresql@16For more details, read: http ...
搭建NFS服务器(CentOS)
需求背景与架构最近想要在集群内搭建一个jupyterhub,在使用官方helm部署的时候遇到问题,由于本博客所在集群是自建的,之前没有持久化挂载的需求,因此集群内并没有创建默认的StorageClass。
部署时发现pod未能启动成功:
1234> k get pods NAME READY STATUS RESTARTS AGE hub-75796fd77c-68z57 0/1 Pending 0 4h4m proxy-5b89d9c486-rdrkb 1/1 Running 0 4h4m
从event可以看出,是由于没有持久化卷导致的:
12345678910> k describe pod hub-75796fd77c-68z57Events: Type Reason Age From ...
Deployment模版仓库
1. Jenkins123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124############### pvc ###################---apiVersion: v1kind: PersistentVolumemetadata: name: jenkins-data-home labels: type: localspec: storageClassName: manual capacity: storage: 1Gi accessModes: - ReadWriteMan ...
Nginx模版仓库
1. http + https 反向代理123456789101112131415161718192021222324252627282930313233343536373839404142434445server { listen 80; server_name <domain>; # Redirect all traffic to SSL rewrite ^ https://$server_name$request_uri? permanent;}server { listen 443; # enables SSLv3/TLSv1, but not SSLv2 which is weak and should no longer be used. proxy_ssl_protocols TLSv1.2 TLSv1.3; proxy_ssl_ciphers DEFAULT; server_name <domain>; ## Access and error logs. access_log /var/log/ ...
Jenkinsfile模版仓库
1. git -> dockerhub -> kubernetes
适用jenkins运行在kubernetes中。
需要安装git和kubernetes插件。
12345678910111213141516171819202122232425262728293031323334353637383940podTemplate(cloud: '<cloud-name>', yaml:'''apiVersion: v1kind: Podspec: containers: - name: docker-kubectl image: <docker-kubectl-image> securityContext: privileged: true''') { node(POD_LABEL) { def myRepo = checkout scm def commitHash = sh( ...
Dockerfile模版仓库
1. Hexo镜像模版12345678910111213141516171819202122232425# ======= 缓存 =======FROM node as builderWORKDIR /appCOPY package.json .RUN npm install# ======= 构建 =======FROM nodeENV HEXO_SsERVER_PORT=4000# 安装依赖RUN npm cache clear --force && \ npm install -g hexo-cliWORKDIR /appCOPY --from=builder /app/ /app/COPY . .# 暴露端EXPOSE ${HEXO_SERVER_PORT}# 运行指令CMD hexo server -p ${HEXO_SERVER_PORT}
Linux工具箱
防火墙控制
ufw
12ufw allow httpufw allow https
jenkins连接kubernetes凭据配置
安装证书工具安装cfssl,此工具生成证书非常方便, pem证书与crt证书,编码一致可直接使用。
1234567891011wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64chmod +x cfssl_linux-amd64mv cfssl_linux-amd64 /usr/local/bin/cfsslwget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64chmod +x cfssljson_linux-amd64mv cfssljson_linux-amd64 /usr/local/bin/cfssljsonwget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64chmod +x cfssl-certinfo_linux-amd64mv cfssl-certinfo_linux-amd64 /usr/local/bin/cfssl-certinfo
准备证书签名请求1vim admin-csr.json
内容如下
1 ...
使用kubeadm搭建集群
前置准备
准备两台服务器,一台做master,一台做slave,每台机器内存要大于2G。
在命令行通过ufw等防火墙工具开放相关端口,如果使用的是云服务则应去控制台页面进行设置。
确保每台机器已经安装了容器运行时,如docker。
1. 安装 kubeadm、kubelet 和 kubectl123456789101112131415cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=https://pkgs.k8s.io/core:/stable:/v1.26/rpm/enabled=1gpgcheck=1gpgkey=https://pkgs.k8s.io/core:/stable:/v1.26/rpm/repodata/repomd.xml.keyexclude=kubelet kubeadm kubectl cri-tools kubernetes-cniEOF# 将 SELinux 设置为 permissive 模式(相当于将其禁用)sud ...
Docker In Action
1. 如何在CentOS环境安装docker?12345sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.reposudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginsystemctl start docker# 验证是否安装成功docker -v
2. 如何将本地镜像推送到dockerhub?123docker login -u <username> -p <token>docker tag <local-image-id> <remote-username>/<reponame:version>docker push <remote-username>/<reponame:version>