首页 > 其他 > 详细

openshift 4.3 QoS

时间:2020-04-24 00:43:45      阅读:122      评论:0      收藏:0      [点我收藏+]

https://github.com/wangzheng422/docker_env/blob/master/redhat/ocp4/4.3/4.3.QoS.nic.high.md

openshift 4.3 QoS

https://docs.openshift.com/container-platform/4.3/nodes/pods/nodes-pods-configuring.html

https://docs.openshift.com/container-platform/3.11/admin_guide/managing_pods.html#admin-guide-manage-pods-limit-bandwidth

video


# 查看infra0, infra1上面的端口速度,可以看到是10GE的网口
ethtool em1
# Settings for em1:
#         Supported ports: [ FIBRE ]
#         Supported link modes:   1000baseT/Full
#                                 10000baseT/Full
#         Supported pause frame use: Symmetric Receive-only
#         Supports auto-negotiation: No
#         Supported FEC modes: Not reported
#         Advertised link modes:  10000baseT/Full
#         Advertised pause frame use: No
#         Advertised auto-negotiation: No
#         Advertised FEC modes: Not reported
#         Speed: 10000Mb/s
#         Duplex: Full
#         Port: FIBRE
#         PHYAD: 1
#         Transceiver: internal
#         Auto-negotiation: off
#         Supports Wake-on: g
#         Wake-on: d
#         Current message level: 0x00000000 (0)

#         Link detected: yes

# 创建2个服务端Pod,用iperf3作为服务端,服务端不限速。再创建一个客户端Pod,有iperf3作为客户端。
cat << EOF > demo.yaml
---
kind: Pod
apiVersion: v1
metadata:
  name: demo-pod1
  namespace: demo
spec:
  nodeSelector:
    kubernetes.io/hostname: ‘infra1.hsc.redhat.ren‘
  restartPolicy: Always
  containers:
    - name: demo1
      image: >- 
        registry.redhat.ren:5443/docker.io/wangzheng422/centos:centos7-test
      env:
        - name: key
          value: value
      command: ["iperf3", "-s", "-p" ]
      args: [ "6666" ]
      imagePullPolicy: Always
---
kind: Pod
apiVersion: v1
metadata:
  name: demo-pod2
  namespace: default
spec:
  nodeSelector:
    kubernetes.io/hostname: ‘infra1.hsc.redhat.ren‘
  restartPolicy: Always
  containers:
    - name: demo1
      image: >- 
        registry.redhat.ren:5443/docker.io/wangzheng422/centos:centos7-test
      env:
        - name: key
          value: value
      command: ["iperf3", "-s", "-p" ]
      args: [ "6666" ]
      imagePullPolicy: Always
---
kind: Pod
apiVersion: v1
metadata:
  name: iperf
  namespace: zte
spec:
  nodeSelector:
    kubernetes.io/hostname: ‘infra0.hsc.redhat.ren‘
  restartPolicy: Always
  containers:
    - name: iperf
      image: >- 
        registry.redhat.ren:5443/docker.io/wangzheng422/centos:centos7-test
      env:
        - name: key
          value: value
      command: ["/bin/bash", "-c", "--" ]
      args: [ "trap : TERM INT; sleep infinity & wait" ]
      imagePullPolicy: Always
EOF
oc apply -f demo.yaml

# 查找服务端pod ip
oc get pod -A -o wide | grep demo-pod
oc get pod -n zte -o wide

pod_demo1_ip=$(oc get pod -n demo demo-pod1 -o json | jq -r ‘.status.podIPs[0].ip‘)

pod_demo2_ip=$(oc get pod -n default demo-pod2 -o json | jq -r ‘.status.podIPs[0].ip‘)

echo $pod_demo1_ip
echo $pod_demo2_ip

# 进入客户端,对两个服务端pod进行测速
/bin/rm -f nohup.out
nohup oc exec -n zte -it iperf -- iperf3 -T demo1 -i 10 -t 30 -b 3G -P 6 -p 6666 -c $pod_demo1_ip 2>&1 &

nohup oc exec -n zte -it iperf -- iperf3 -T demo2 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo2_ip 2>&1 &

tail -f nohup.out

# 调整流量重新测试,对两个服务端pod进行测速
/bin/rm -f nohup.out
nohup oc exec -n zte -it iperf -- iperf3 -T demo1 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo1_ip 2>&1 &

nohup oc exec -n zte -it iperf -- iperf3 -T demo2 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo2_ip 2>&1 &

tail -f nohup.out

# 调整流量重新测试,对两个服务端pod进行测速
/bin/rm -f nohup.out
nohup oc exec -n zte -it iperf -- iperf3 -T demo1 -i 10 -t 30 -b 8G -P 6 -p 6666 -c $pod_demo1_ip 2>&1 &

nohup oc exec -n zte -it iperf -- iperf3 -T demo2 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo2_ip 2>&1 &

tail -f nohup.out

# 查看服务端pod的日志,可以看到流量信息

# 更改服务端带宽为6G
oc delete pod -n demo demo-pod1

cat << EOF > demo1.yaml
---
kind: Pod
apiVersion: v1
metadata:
  name: demo-pod1
  namespace: demo
  annotations:
    kubernetes.io/ingress-bandwidth: 6G
    kubernetes.io/egress-bandwidth: 6G
spec:
  nodeSelector:
    kubernetes.io/hostname: ‘infra1.hsc.redhat.ren‘
  restartPolicy: Always
  containers:
    - name: demo1
      image: >- 
        registry.redhat.ren:5443/docker.io/wangzheng422/centos:centos7-test
      env:
        - name: key
          value: value
      command: ["iperf3", "-s", "-p" ]
      args: [ "6666" ]
      imagePullPolicy: Always

EOF
oc apply -n demo -f demo1.yaml

# 查找服务端pod ip
oc get pod -A -o wide | grep demo-pod
oc get pod -n zte -o wide

pod_demo1_ip=$(oc get pod -n demo demo-pod1 -o json | jq -r ‘.status.podIPs[0].ip‘)

pod_demo2_ip=$(oc get pod -n default demo-pod2 -o json | jq -r ‘.status.podIPs[0].ip‘)

echo $pod_demo1_ip
echo $pod_demo2_ip

# 调整流量重新测试,对两个服务端pod进行测速
/bin/rm -f nohup.out
nohup oc exec -n zte -it iperf -- iperf3 -T demo1 -i 10 -t 30 -b 8G -P 6 -p 6666 -c $pod_demo1_ip 2>&1 &

nohup oc exec -n zte -it iperf -- iperf3 -T demo2 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo2_ip 2>&1 &

tail -f nohup.out

# 查看服务端pod的日志,可以看到流量信息

# 更改服务端带宽为3G
oc delete pod -n demo demo-pod1

cat << EOF > demo1.yaml
---
kind: Pod
apiVersion: v1
metadata:
  name: demo-pod1
  namespace: demo
  annotations:
    kubernetes.io/ingress-bandwidth: 3G
    kubernetes.io/egress-bandwidth: 3G
spec:
  nodeSelector:
    kubernetes.io/hostname: ‘infra1.hsc.redhat.ren‘
  restartPolicy: Always
  containers:
    - name: demo1
      image: >- 
        registry.redhat.ren:5443/docker.io/wangzheng422/centos:centos7-test
      env:
        - name: key
          value: value
      command: ["iperf3", "-s", "-p" ]
      args: [ "6666" ]
      imagePullPolicy: Always

EOF
oc apply -n demo -f demo1.yaml

# 查找服务端pod ip
oc get pod -A -o wide | grep demo-pod
oc get pod -n zte -o wide

pod_demo1_ip=$(oc get pod -n demo demo-pod1 -o json | jq -r ‘.status.podIPs[0].ip‘)

pod_demo2_ip=$(oc get pod -n default demo-pod2 -o json | jq -r ‘.status.podIPs[0].ip‘)

echo $pod_demo1_ip
echo $pod_demo2_ip

# 调整流量重新测试,对两个服务端pod进行测速
/bin/rm -f nohup.out
nohup oc exec -n zte -it iperf -- iperf3 -T demo1 -i 10 -t 30 -b 8G -P 6 -p 6666 -c $pod_demo1_ip 2>&1 &

nohup oc exec -n zte -it iperf -- iperf3 -T demo2 -i 10 -t 30 -b 6G -P 6 -p 6666 -c $pod_demo2_ip 2>&1 &

tail -f nohup.out

# 查看服务端pod的日志,可以看到流量信息

oc delete -f demo.yaml

openshift 4.3 QoS

原文:https://www.cnblogs.com/wandering-star/p/12764589.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!