File tree Expand file tree Collapse file tree 4 files changed +5
-4
lines changed Expand file tree Collapse file tree 4 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ kubectl port-forward nginx-pod 4000:80
287
287
` kubectl exec -it` 可以用来进入 Pod 内容器的 Shell。通过命令下面的命令来配置 `nginx` 的首页内容。
288
288
289
289
` ` ` shell
290
- kubectl exec -it nginx-pod /bin/bash
290
+ kubectl exec -it nginx-pod -- /bin/bash
291
291
292
292
echo "hello kubernetes by nginx!" > /usr/share/nginx/html/index.html
293
293
@@ -934,7 +934,7 @@ kubectl get service
934
934
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
935
935
# service-hellok8s-clusterip ClusterIP 10.104.96.153 <none> 3000/TCP 10s
936
936
937
- kubectl exec -it nginx-pod /bin/bash
937
+ kubectl exec -it nginx-pod -- /bin/bash
938
938
# root@nginx-pod:/# curl 10.104.96.153:3000
939
939
# [v3] Hello, Kubernetes!, From host: hellok8s-deployment-5d5545b69c-9gm8r
940
940
# root@nginx-pod:/# curl 10.104.96.153:3000
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ kubectl delete -f nginx.yaml
85
85
# pod "nginx" deleted
86
86
` ` `
87
87
88
- 最后,根据我们在 `container` 的那节构建的 `hellok8s:v1` 的镜像,同时参考 `nginx` pod 的资源定义,你能独自编写出 `hellok8s:v1` Pod 的资源文件吗。 并通过 `port-forward` 到本地的 `3000` 端口进行访问,最终得到字符串 `[v1] Hello, Kubernetes!`。
88
+ 最后,根据我们在 `container` 的那节构建的 `hellok8s:v1` 的镜像,同时参考 `nginx` pod 的资源定义,你能独自编写出 `hellok8s:v1` Pod 的资源文件吗? 并通过 `port-forward` 到本地的 `3000` 端口进行访问,最终得到字符串 `[v1] Hello, Kubernetes!`。
89
89
90
90
` hellok8s:v1` Pod 资源定义和相应的命令如下所示:
91
91
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ docker run hello-world
78
78
这一步是可选的,如果不安装的话,后续所有 ` kubectl ` 相关的命令,使用 ` minikube kubectl ` 命令替代即可。
79
79
80
80
如果你不想使用 ` minikube kubectl ` 或者配置相关环境变量来进行下面的教学的话,可以考虑直接安装 ` kubectl ` 。
81
+ 以下为 MacOS 的安装方式,Linux & Windows 操作系统可以参考[ 官方文档] ( https://kubernetes.io/zh-cn/docs/tasks/tools/ ) 快速安装。
81
82
82
83
``` shell
83
84
brew install kubectl
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ kubectl get service
138
138
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
139
139
# service-hellok8s-clusterip ClusterIP 10.104.96.153 <none> 3000/TCP 10s
140
140
141
- kubectl exec -it nginx-pod /bin/bash
141
+ kubectl exec -it nginx-pod -- /bin/bash
142
142
# root@nginx-pod:/# curl 10.104.96.153:3000
143
143
# [v3] Hello, Kubernetes!, From host: hellok8s-deployment-5d5545b69c-9gm8r
144
144
# root@nginx-pod:/# curl 10.104.96.153:3000
You can’t perform that action at this time.
0 commit comments