Istio注入
概念简单的说,Istio注入其实就是将一些额外的容器、配置添加到我们的Pod模板中。注入的方式有两种,一种是手工注入,还有一个自动注入。下面这张图我们明显可以看出来相对于注入前的Pod,注入后的Pod多了2个容器,其实还有写入了一些iptables规则。
手工注入我们先创建一个namespace
kubectl create ns injection
我们编写一个pod的yaml
apiVersion: apps/v1kind: Deploymentmetadata: name: test-injection namespace: injectionspec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14-alpine imagePullPoli ...
Istio升级
前言已经安装好了istio-1.4.5,我们下面将升级成istio-1.5.0,升级前有以下注意事项:(1)版本之间不能跨度太大(2)本次升级是基于istioctl,请确保当前istio是通过istioctl安装的(3)确保升级前后的profile是一致的
下载istio-1.5.0Istio官网:https://istio.io/latest/zh/可能由于网络原因,无法在官网下载,我这边准备了istio-1.5.0
链接:https://pan.baidu.com/s/1ksgp8kRgtmnFTLpldoKAGw 提取码:7tka
升级解压tar -zxvf istio-1.5.0-linux.tar.gzmv istio-1.5.0 ../
修改环境变量#vim /etc/profileISTIO_HOME=/usr/local/istio-1.5.0MAVEN_HOME=/usr/local/mavenPATH=$PATH:${MAVEN_HOME}/bin:${ISTIO_HOME}/binexport PATH MAVEN_HOM ...
Istio安装与卸载
Istio官网:https://istio.io/latest/zh/
下载istio-1.4.5链接:https://pan.baidu.com/s/1WtvRTeih_6PumGp2Q2D3UA 提取码:lxce
安装解压后在/etc/profile配置环境变量
ISTIO_HOME=/usr/local/istio-1.4.5MAVEN_HOME=/usr/local/mavenPATH=$PATH:${MAVEN_HOME}/bin:${ISTIO_HOME}/binexport PATH MAVEN_HOME ISTIO_HOME#使环境变量生效source /etc/profile#查看版本号istioctl version --remote=false
#查看istio的profileistioctl profile list#安装istioistioctl manifest apply --set profile=demo
查看pod启动情况
卸载istioctl manifest generate --set profile ...
Kubernetes中command、args和Dockerfile中entrypoint、cmd之间的作用
当用户同时在kubernetes中的yaml文件中写了command和args的时候自然是可以覆盖DockerFile中ENTRYPOINT的命令行和参数,完整的情况分类如下:如果command和args均没有写,那么用Docker默认的配置。如果command写了,但args没有写,那么Docker默认的配置会被忽略而且仅仅执行.yaml文件的command(不带任何参数的)。如果command没写,但args写了,那么Docker默认配置的ENTRYPOINT的命令行会被执行,但是调用的参数是.yaml中的args。如果如果command和args都写了,那么Docker默认的配置被忽略,使用.yaml的配置。
转载:https://www.orchome.com/1438
Zabbix仪表盘显示邮件发送成功,Mailx日志出现Error initializing NSS Unknown error -8015
zabbix显示邮件发送成功,但是并未收到邮件,mailx日志出现Error initializing NSS Unknown error -8015错误
解决查看/etc/mail.rc的set nss-config-dir配置项
set nss-config-dir=/tmp/.certs
查看证书是否存在,zabbix是否对/tmp/.certs有权限
chown -R zabbix:zabbix /tmp/.certs
最后测试可以正常收到邮件
通过ingress-nginx暴露apache服务
在之前的文章中已经介绍了ingress-nginx的部署,本文介绍下怎么使用ingress-nginx去暴露我们的服务
部署服务apiVersion: apps/v1kind: Deploymentmetadata: name: my-httpdspec: replicas: 3 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: httpd image: httpd imagePullPolicy: IfNotPresent ports: - containerPort: 80---apiVersion: v1kind: Servicemetadata: name: my-httpdspec: type: ClusterIP selector: app: myapp p ...
Kubernetes部署ingress-nginx
本文主要介绍nodeport方式部署ingress-nginx
下载mandatory.yaml地址:https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
在node节点下载镜像#下载所需镜像docker pull tangweifeng/defaultbackend-amd64:1.5docker pull tangweifeng/nginx-ingress-controller:0.20.0#重命名,改成mandatory.yaml里面镜像的名称docker tag tangweifeng/defaultbackend-amd64:1.5 k8s.gcr.io/defaultbackend-amd64:1.5docker tag tangweifeng/nginx-ingress-controller:0.20.0 quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.20 ...
Kubernetes部署redis-cluster集群
安装NFSNFS安装可以参照我前面的几篇文章,这边就略过了
cat /etc/exports/redis/pv *(async,insecure,no_root_squash,no_subtree_check,rw)mkdir -p /redissystemctl restart rpcbindsystemctl restart nfs
创建名称空间apiVersion: v1kind: Namespacemetadata: name: redis-cluster labels: name: redis-cluster
创建configmap准备一份redis.conf文件放到/redis目录下,修改redis.conf下面配置
bind 0.0.0.0dir /data pidfile /data/redis_6379.pidlogfile "/data/redis.log"cluster-enabled yes cluster-config-file nodes-6379.conf cluster-node-timeout 15000appendo ...
Kubernetes部署Prometheus
获取prometheus注意下载的prometheus版本是否支持自己的kubernetes版本下载地址:https://github.com/prometheus-operator/kube-prometheus/archive/v0.2.0.zip
mkdir prometheuscd prometheus
Prometheus部署cd /k8s/prometheus/kube-prometheus-0.2.0/manifests
vim grafana-service.yaml
apiVersion: v1kind: Servicemetadata: labels: app: grafana name: grafana namespace: monitoringspec: type: NodePort ports: - name: http port: 3000 nodePort: 30100 targetPort: http selector: app: grafana
vim prometheus-service.yaml
ap ...
Kubernetes中使用NFS的StorageClass
安装NFS# 安装nfsyum -y install nfs-utils rpcbind#创建nfs共享目录及设置权限mkdir /nfs/renren -pchmod 755 /nfs/renren -R#配置nfscat /etc/exports/nfs/renren *(async,insecure,no_root_squash,no_subtree_check,rw)
启动NFSsystemctl start rpcbindsystemctl enable rpcbindsystemctl status rpcbindsystemctl start nfssystemctl enable nfssystemctl status nfs
客户端在使用NFS时,需要安装NFS
#在客户端上安装启动nfsyum -y install nfs-utils rpcbindsystemctl start rpcbindsystemctl enable rpcbindsystemctl start nfssystemctl enable nfs#查看nfs共享showmount -e k8 ...