k8s实践

1.简单yml

apiVersion: v1

kind: Pod

metadata:

name: nginx-pod

labels:

name: nginx-pod

spec:

containers:

  • name: nginx-container

image: nginx

2.加入replicasyml

apiVersion: apps/v1

kind: ReplicaSet

metadata:

name: nginx-deployment

spec:

replicas: 4

selector:

matchLabels:

app: nginx

template:

metadata:

labels:

app: nginx

spec:

containers:

  • name: nginx-container

image: nginx

3.deployment yml

apiVersion: apps/v1

kind: Deployment

metadata:

name: nginx-deployment

labels:

name: nginx-deploy

spec:

replicas: 4

selector:

matchLabels:

app: nginx

template:

metadata:

labels:

app: nginx

spec:

containers:

  • name: nginx-container

image: nginx

4.service yml

apiVersion: v1

kind: Service

metadata:

name: nginx-service

spec:

type: NodePort

selector:

app: nginx

ports:

  • port: 80

targetPort: 80

nodePort: 30008

内容来源:【入门篇】Kubernetes的核心概念以及在本地部署多种资源_哔哩哔哩_bilibili

另外个人网站数字证书https,可参考下面网址
Nginx实战 - 配置HTTPS | 数字证书和私钥 | Docker Compose容器_哔哩哔哩_bilibili

相关推荐
薛定猫AI2 小时前
Codex 与 Claude Code 全平台安装配置指南(Windows / macOS / Linux)
linux·windows·macos
仙柒4155 小时前
Docker原理
运维·docker·容器
Cat_Rocky9 小时前
Kubernetes集群升级指南以及自动更新证书
云原生·容器·kubernetes
米高梅狮子9 小时前
第2章 docker容器
运维·docker·云原生·容器·架构·kubernetes·自动化
kidwjb10 小时前
信号量在进程中的使用
linux·进程间通信
万里侯10 小时前
分布式系统设计原则:构建高可用的系统架构
微服务·容器·k8s
sulikey11 小时前
个人Linux操作系统学习笔记2 - gcc与库的理解
linux·笔记·学习·操作系统·gcc·
二宝哥12 小时前
Linux虚拟机网络配置
linux·运维·服务器
卧室小白12 小时前
docker网络与服务编排与集群
运维·docker·容器
陳103012 小时前
Linux:进程间通信 和 简单进程池
linux·运维·服务器