Skip to content

Commit

Permalink
Merge pull request #103 from nelvko/main
Browse files Browse the repository at this point in the history
fix: fix typo, update outdated command.
  • Loading branch information
guangzhengli authored Dec 16, 2024
2 parents dba35af + 186eeb2 commit fb76206
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ kubectl port-forward nginx-pod 4000:80
`kubectl exec -it` 可以用来进入 Pod 内容器的 Shell。通过命令下面的命令来配置 `nginx` 的首页内容。

```shell
kubectl exec -it nginx-pod /bin/bash
kubectl exec -it nginx-pod -- /bin/bash
echo "hello kubernetes by nginx!" > /usr/share/nginx/html/index.html
Expand Down Expand Up @@ -934,7 +934,7 @@ kubectl get service
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
# service-hellok8s-clusterip ClusterIP 10.104.96.153 <none> 3000/TCP 10s
kubectl exec -it nginx-pod /bin/bash
kubectl exec -it nginx-pod -- /bin/bash
# root@nginx-pod:/# curl 10.104.96.153:3000
# [v3] Hello, Kubernetes!, From host: hellok8s-deployment-5d5545b69c-9gm8r
# root@nginx-pod:/# curl 10.104.96.153:3000
Expand Down
2 changes: 1 addition & 1 deletion docs/pod.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ kubectl delete -f nginx.yaml
# pod "nginx" deleted
```

最后,根据我们在 `container` 的那节构建的 `hellok8s:v1` 的镜像,同时参考 `nginx` pod 的资源定义,你能独自编写出 `hellok8s:v1` Pod 的资源文件吗并通过 `port-forward` 到本地的 `3000` 端口进行访问,最终得到字符串 `[v1] Hello, Kubernetes!`。
最后,根据我们在 `container` 的那节构建的 `hellok8s:v1` 的镜像,同时参考 `nginx` pod 的资源定义,你能独自编写出 `hellok8s:v1` Pod 的资源文件吗并通过 `port-forward` 到本地的 `3000` 端口进行访问,最终得到字符串 `[v1] Hello, Kubernetes!`。

`hellok8s:v1` Pod 资源定义和相应的命令如下所示:

Expand Down
1 change: 1 addition & 0 deletions docs/pre.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ docker run hello-world
这一步是可选的,如果不安装的话,后续所有 `kubectl` 相关的命令,使用 `minikube kubectl` 命令替代即可。

如果你不想使用 `minikube kubectl` 或者配置相关环境变量来进行下面的教学的话,可以考虑直接安装 `kubectl`
以下为 MacOS 的安装方式,Linux & Windows 操作系统可以参考[官方文档](https://kubernetes.io/zh-cn/docs/tasks/tools/)快速安装。

```shell
brew install kubectl
Expand Down
2 changes: 1 addition & 1 deletion docs/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ kubectl get service
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
# service-hellok8s-clusterip ClusterIP 10.104.96.153 <none> 3000/TCP 10s
kubectl exec -it nginx-pod /bin/bash
kubectl exec -it nginx-pod -- /bin/bash
# root@nginx-pod:/# curl 10.104.96.153:3000
# [v3] Hello, Kubernetes!, From host: hellok8s-deployment-5d5545b69c-9gm8r
# root@nginx-pod:/# curl 10.104.96.153:3000
Expand Down

0 comments on commit fb76206

Please sign in to comment.