add new test
This commit is contained in:
parent
164e287c4f
commit
1d4d05ee61
7
redis02/app02-namespace.yaml
Normal file
7
redis02/app02-namespace.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: app02
|
||||
labels:
|
||||
name: app02
|
51
redis02/app02_redis.yaml
Normal file
51
redis02/app02_redis.yaml
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-svc
|
||||
namespace: app02
|
||||
labels:
|
||||
app: redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: redis
|
||||
port: 6379
|
||||
selector:
|
||||
app: app02-redis
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: app02-redis
|
||||
namespace: app02
|
||||
labels:
|
||||
app: redis
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: app02-redis
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: app02-redis
|
||||
name: app02-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: app02-redis
|
||||
image: redis
|
||||
volumeMounts:
|
||||
- name: redis-conf
|
||||
mountPath: "/usr/local/etc"
|
||||
command:
|
||||
- "redis-server"
|
||||
args:
|
||||
- "/usr/local/etc/redis/redis.conf"
|
||||
volumes:
|
||||
- name: redis-conf
|
||||
configMap:
|
||||
name: app02-redis-conf
|
||||
items:
|
||||
- key: redis.conf
|
||||
path: redis/redis.conf
|
14
redis02/busybox.yaml
Normal file
14
redis02/busybox.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test01
|
||||
labels:
|
||||
app: busybox
|
||||
spec:
|
||||
containers:
|
||||
- name: test001
|
||||
image: busybox
|
||||
command:
|
||||
- "ping"
|
||||
args:
|
||||
- "baidu.com"
|
50
redis02/config/redis.conf
Normal file
50
redis02/config/redis.conf
Normal file
@ -0,0 +1,50 @@
|
||||
#daemonize yes
|
||||
pidfile /data/redis.pid
|
||||
port 6379
|
||||
tcp-backlog 30000
|
||||
timeout 0
|
||||
tcp-keepalive 10
|
||||
loglevel notice
|
||||
logfile /data/redis.log
|
||||
databases 16
|
||||
#save 900 1
|
||||
#save 300 10
|
||||
#save 60 10000
|
||||
stop-writes-on-bgsave-error no
|
||||
rdbcompression yes
|
||||
rdbchecksum yes
|
||||
dbfilename dump.rdb
|
||||
dir /data
|
||||
slave-serve-stale-data yes
|
||||
slave-read-only yes
|
||||
repl-diskless-sync no
|
||||
repl-diskless-sync-delay 5
|
||||
repl-disable-tcp-nodelay no
|
||||
slave-priority 100
|
||||
requirepass ibalife
|
||||
maxclients 30000
|
||||
appendonly no
|
||||
appendfilename "appendonly.aof"
|
||||
appendfsync everysec
|
||||
no-appendfsync-on-rewrite no
|
||||
auto-aof-rewrite-percentage 100
|
||||
auto-aof-rewrite-min-size 64mb
|
||||
aof-load-truncated yes
|
||||
lua-time-limit 5000
|
||||
slowlog-log-slower-than 10000
|
||||
slowlog-max-len 128
|
||||
latency-monitor-threshold 0
|
||||
notify-keyspace-events KEA
|
||||
hash-max-ziplist-entries 512
|
||||
hash-max-ziplist-value 64
|
||||
list-max-ziplist-entries 512
|
||||
list-max-ziplist-value 64
|
||||
set-max-intset-entries 1000
|
||||
zset-max-ziplist-entries 128
|
||||
zset-max-ziplist-value 64
|
||||
hll-sparse-max-bytes 3000
|
||||
activerehashing yes
|
||||
client-output-buffer-limit normal 0 0 0
|
||||
client-output-buffer-limit slave 256mb 64mb 60
|
||||
client-output-buffer-limit pubsub 32mb 8mb 60
|
||||
hz 10
|
47
redis02/readme.md
Normal file
47
redis02/readme.md
Normal file
@ -0,0 +1,47 @@
|
||||
create namespace
|
||||
|
||||
kubectl apply -f namespace.yaml
|
||||
|
||||
|
||||
# 查看 namespace
|
||||
kubectl get namespace --show-labels
|
||||
kubectl config view | grep namespace:
|
||||
# 切换默认namespace
|
||||
kubectl config current-context
|
||||
kubectl config set-context test --namespace=app01 \
|
||||
--cluster=docker-desktop \
|
||||
--user=docker-desktop
|
||||
|
||||
kubectl config set-context prod --namespace=production \
|
||||
--cluster=docker-desktop \
|
||||
--user=docker-desktop
|
||||
kubectl config view
|
||||
# 切换环境到DEV
|
||||
kubectl config use-context test
|
||||
# check 当前环境
|
||||
kubectl config current-context
|
||||
# 查看配额
|
||||
kubectl get resourcequotas
|
||||
kubectl get resourcequota app01-redis --output=yaml
|
||||
|
||||
# create configmap
|
||||
kubectl create configmap app01-redis-conf --from-file=redis.conf
|
||||
|
||||
kubectl get configmap -n miles-app01
|
||||
|
||||
NAME DATA AGE
|
||||
kube-root-ca.crt 1 3m30s
|
||||
miles-app01-redis-conf 1 20s
|
||||
|
||||
# 创建和查看 pod
|
||||
kubectl apply -f app01_redis.yaml
|
||||
kubectl get pods -n app01
|
||||
|
||||
# 注意:configMap 会挂在 /usr/local/etc/redis/redis.conf 上。与 mountPath 和 configMap 下的 path 一同指定
|
||||
|
||||
kubectl get pod miles-app01-redis-b48ff8c66-q5cv2 -n miles-app01
|
||||
kubectl run busybox --image=busybox --command -- ping baidu.com
|
||||
kubectl exec -it busybox -- /bin/bash
|
||||
k describe replicaset.apps/app01-redis-64847ffc48
|
||||
k get all -ALL
|
||||
k describe pods
|
Loading…
x
Reference in New Issue
Block a user