1,启动Kubernetes命令
systemctl start etcd
systemctl start flanneld(可选)
systemctl start docker
systemctl start kube-apiserver 或 kube-apiserver --insecure-bind-address=0.0.0.0 --insecure-port=8080 --etcd_servers=http://127.0.0.1:2379 --service-cluster-ip-range='127.0.0.1/24' &
kube-apiserver配置文件/etc/kubernetes/apiserver
systemctl start kube-controller-manager
systemctl start kube-scheduler
systemctl start kubelet
systemctl start kube-proxy
systemctl daemon-reload
日志目录/var/log/kubernetes
2,创建和查看ReplicationController
kubectl create -f [redis-master-controller.yaml]
kubectl get rc
kubectl get pods
3,创建和查看Service
kubectl create -f [redis-master-servcie.yaml]
kubectl get services
4,一键动态缩放Pod
kubectl scale rc [redis-slave] --replicas=3
5,查看所有端点(endpoints)
kubectl get endpoints
6,设置etcd
etcdctl set /atomic.io/network '{ "Network": "172.17.0.0/16" }'
7,删除操作
kubectl delete -f 文件名
kubectl delete pods <podname> --grace-period=0 --force 强制删除
8,修改资源配置
kubectl edit pod <podname>
kubectl get pod <podname> -o yaml >> /tmp/cronm-tmp.yaml
kubectl replace -f /tmp/nginx-tmp.yaml
9,查看pod日志
kubectl gets <podname>
kubectl logs <pod_name>
kubectl logs <pod_name> -c <container_name>
docker logs <container_id>
10,查看Kubernetes系统日志
systemctl status kube-controller-manager -l
journalctl -u kube-controller-manage