kubectl version
----------------------------------------------------------------------------
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:35:51Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:28:14Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
注意:
For Calico to work correctly, you need to pass --pod-network-cidr=192.168.0.0/16
to kubeadm init
or update the calico.yml
file to match your Pod network. Note that Calico works on amd64
only.
git clone https://github.com/kubernetes-incubator/metrics-server
vi metrics-server/deploy/1.8+/metrics-server-deployment.yaml
args:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: metrics-server
namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: metrics-server
namespace: kube-system
labels:
k8s-app: metrics-server
spec:
selector:
matchLabels:
k8s-app: metrics-server
template:
metadata:
name: metrics-server
labels:
k8s-app: metrics-server
spec:
serviceAccountName: metrics-server
volumes:
# mount in tmp so we can safely use from-scratch images and/or read-only containers
- name: tmp-dir
emptyDir: {}
containers:
- name: metrics-server
image: k8s.gcr.io/metrics-server-amd64:v0.3.1
imagePullPolicy: Always
volumeMounts:
- name: tmp-dir
mountPath: /tmp
args:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
kubectl apply -f metrics-server/deploy/1.8+/
kubectl top nodes
----------------------------------------------------------
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
k8s-master 486m 24% 1853Mi 51%
k8s-node 146m 7% 1855Mi 51%
kubectl top pods --all-namespaces
-----------------------------------------------------------------------------------
NAMESPACE NAME CPU(cores) MEMORY(bytes)
default nginx-77c5cd5446-k2l45 0m 2Mi
kube-system calico-etcd-k5bkd 10m 12Mi
kube-system calico-kube-controllers-6c6566b687-qmw4x 6m 15Mi
kube-system calico-node-7brzm 39m 30Mi
kube-system calico-node-8gzhp 41m 33Mi
kube-system coredns-86c58d9df4-4cgzk 6m 11Mi
kube-system coredns-86c58d9df4-jpwjw 7m 11Mi
kube-system etcd-k8s-master 32m 70Mi
kube-system kube-apiserver-k8s-master 73m 412Mi
kube-system kube-controller-manager-k8s-master 62m 78Mi
kube-system kube-proxy-kt28z 7m 15Mi
kube-system kube-proxy-zfmqb 7m 12Mi
kube-system kube-scheduler-k8s-master 27m 16Mi
kube-system metrics-server-76db6db868-f827l 2m 14Mi