1.列出pod并排序
$ kubectl get pod --sort-by .metadata.name
2.找出pod中的错误日志
#要求是把错误内容输出到某个文件中,可以粘贴,也可以直接重定向文件
$ kubectl logs mypod-798fcd9949-lk9rc | grep error > xx.log
3.创建一个pod ,并调度到某个节点上
$ cat > pod.yaml << EOF apiVersion: v1 kind: Pod metadata: name: nginx labels: env: test spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent nodeSelector: disktype: ssd EOF
$ kubectl create -f pod.yaml
4.列出正常节点的个数
$ kubectl get node | grep -w Ready
5.pod中挂载volume
apiVersion: v1 kind: Pod metadata: name: test-pd spec: containers: - image: k8s.gcr.io/test-webserver name: test-container volumeMounts: - mountPath: /cache name: cache-volume volumes: - name: cache-volume emptyDir: {}
6.提供一个pod