【kubenetus】kubenetus运维

重启K8S服务

systemctl stop kubelet
systemctl stop kube-apiserver
systemctl stop kube-proxy
systemctl stop kube-controller-manager   # 如果是master节点,需要执行
systemctl stop kube-scheduler           # 如果是master节点,需要执行
systemctl stop flanneld
systemctl stop docker
systemctl restart iptables
systemctl start flanneld
systemctl start docker
systemctl start kubelet
systemctl start kube-apiserver
systemctl start kube-proxy
systemctl start kube-controller-manager  # 如果是master节点,需要执行
systemctl start kube-scheduler          # 如果是master节点,需要执行

systemctl status NetworkManager

查看kube-dns服务

[root@yp-epc-test1 /opt/install/harbor]#  kubectl  get po -o wide --namespace=kube-system
NAME                READY     STATUS    RESTARTS   AGE       NODE
kube-dns-v8-9xf6o   3/3       Running   20         55m       10.10.10.7

重启kube-dns服务

[root@yp-epc-test1 /opt/install/kubernetes]#  pwd
/opt/install/kubernetes
[root@yp-epc-test1 /opt/install/kubernetes]#  ll *dns*
-rw-r----- 1 root root 1636 Aug 24  2017 skydns-rc.yaml
-rw-r----- 1 root root  376 Aug 21  2017 skydns-svc.yaml

kubectl delete -f skydns-rc.yaml
kubectl delete -f skydns-svc.yaml

kubuctl create -f skydns-rc.yaml
kubuctl create -f skydns-svc.yaml

kubectl describe pod kube-dns-v8-9xf6o  --namespace=kube-system

重启harbor

cd /opt/install/harbor

docker-compose down
docker-compose up -d  #后台启动

curl http://ip:80  #查看是否启动OK

harbor报502 Gate way错误

现在的解决办法是,不停的关闭,重启,直至OK

重装iptables

配置文件备份

cat /etc/sysconfig/iptables

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10250 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 2379 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT -m comment --comment "mariadb"
-A INPUT -p tcp -m tcp --dport 4567 -j ACCEPT -m comment --comment "mariadb"
-A INPUT -p tcp -m tcp --dport 4444 -j ACCEPT -m comment --comment "mariadb"
-A INPUT -p tcp -m tcp --dport 30118 -j ACCEPT -m comment --comment "mariadb-vport"
COMMIT

卸载,然后重装

[root@yp-epc-test1 /opt/install/harbor]#  yum list| grep iptables
iptables.x86_64                        1.4.21-16.el7              @base
iptables-services.x86_64               1.4.21-16.el7              @base
iptables.i686                          1.4.21-16.el7              base
iptables-devel.i686                    1.4.21-16.el7              base
iptables-devel.x86_64                  1.4.21-16.el7              base
iptables-utils.x86_64                  1.4.21-16.el7              base 

yum remove iptable #卸载

yum install -y iptables.x86_64
yum install -y iptables-services.x86_64  #需要安装

systemctl enable iptables
systemctl restart iptables

在指定节点运行pod

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: tomcat-deploy
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: tomcat-app
    spec:
      nodeName: k8s.node1 #指定调度节点为k8s.node1
      containers:
      - name: tomcat
        image: tomcat:8.0
        ports:
        - containerPort: 8080
上一篇:iOS分类底层实现原理小记


下一篇:P1279 字串距离 dp 洛谷