網站首頁 編程語言 正文
k8s創(chuàng)建一個簡單的Pod
nginx-pod.yaml 文件內容:
apiVersion: v1
kind: Pod # 類型為Pod
metadata:
name: nginx-pod # Pod的名稱
labels:
app: nginxlabel
spec:
containers: # Pod內容器的定義部分
- name: nginx # 容器對應的名稱
image: nginx # 容器對應的Docker鏡像
ports:
- containerPort: 80 # 容器應用監(jiān)聽的端口號
創(chuàng)建Pod
[root@k8s-node1 mytestyaml]# kubectl apply -f nginx-pod.yaml
pod/nginx-pod created
查看Pod創(chuàng)建情況
[root@k8s-node1 mytestyaml]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-pod 0/1 ContainerCreating 0 26s <none> k8s-node3 <none> <none>
[root@k8s-node1 mytestyaml]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-pod 1/1 Running 0 79m 10.244.2.58 k8s-node3 <none> <none>
訪問nginx
[root@k8s-node1 mytestyaml]# curl 10.244.2.58
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
出現這樣的,就是訪問成功了。
原文鏈接:https://blog.csdn.net/weixin_44228698/article/details/122025548
- 上一篇:使用postman訪問k8s api
- 下一篇:Excel單元格空,設置為空字符串
相關推薦
- 2024-03-28 Springboot maven加入本地jar,提示找不到類
- 2023-04-04 C語言對于volatile與gcc優(yōu)化的探究_C 語言
- 2022-05-08 Python?matplotlib繪制xkcd動漫風格的圖表_python
- 2022-12-02 python3中join和格式化的用法小結_python
- 2023-04-02 Python中time庫的使用(日期時間)_python
- 2022-04-15 C語言的程序環(huán)境與預處理你真的了解嗎_C 語言
- 2023-07-02 一文詳解Python中l(wèi)ogging模塊的用法_python
- 2022-08-15 當添加一個鍵值對元素時,HashMap發(fā)生了什么?
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發(fā)現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支