k8s坑--current为0的问题

参考链接https://github.com/kubernetes/kubernetes/issues/11355#issuecomment-127378691

定义一个mysql的RC文件:mysql-rc.yaml

apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql
spec:
  replicas: 1
  selector:
    app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        image: mysql
        ports:
        - containerPort: 3306
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "123456"

发布到k8s集群中

# kubectl create -f mysql-rc.yaml

查看刚刚创建的RC,发现current为0

NAME      DESIRED   CURRENT   READY     AGE
mysql     1         0         0         1m

参考文章开头的链接
1,Generate a signing key:

# openssl genrsa -out /tmp/serviceaccount.key 2048

2,vim /etc/kubernetes/apiserver:

KUBE_API_ARGS="--service_account_key_file=/tmp/serviceaccount.key"

3,vim /etc/kubernetes/controller-manager:

KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/tmp/serviceaccount.key"

4,重启服务

# systemctl restart kube-apiserver
# systemctl restart kube-controller-manager

5,删除原来的创建的RC

# kubectl delete -f mysql-rc.yaml

6,重新创建

# kubectl create -f mysql-rc.yaml

7,验证一下

# kubectl get rc
NAME      DESIRED   CURRENT   READY     AGE
mysql     1         1         0         14s

你可能感兴趣的:(k8s)