File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -74,15 +74,15 @@ kubectl port-forward nginx-pod 4000:80
7474我们可以通过 `logs` 或者 `logs -f` 命令查看 pod 日志,可以通过 `exec -it` 进入 pod 或者调用容器命令,通过 `delete pod` 或者 `delete -f nginx.yaml` 的方式删除 pod 资源。这里可以看到 [kubectl 所有命令](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)。
7575
7676` ` ` shell
77- kubectl logs --follow nginx
77+ kubectl logs --follow nginx-pod
7878
79- kubectl exec nginx -- ls
79+ kubectl exec nginx-pod -- ls
8080
81- kubectl delete pod nginx
82- # pod "nginx" deleted
81+ kubectl delete pod nginx-pod
82+ # pod "nginx-pod " deleted
8383
8484kubectl delete -f nginx.yaml
85- # pod "nginx" deleted
85+ # pod "nginx-pod " deleted
8686` ` `
8787
8888最后,根据我们在 `container` 的那节构建的 `hellok8s:v1` 的镜像,同时参考 `nginx` pod 的资源定义,你能独自编写出 `hellok8s:v1` Pod 的资源文件吗?并通过 `port-forward` 到本地的 `3000` 端口进行访问,最终得到字符串 `[v1] Hello, Kubernetes!`。
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ kubectl get service
117117apiVersion: v1
118118kind: Pod
119119metadata:
120- name: nginx
120+ name: nginx-pod
121121 labels:
122122 app: nginx
123123spec:
You can’t perform that action at this time.
0 commit comments