当前位置: 首页 > news >正文

k8s新增jupyter服务

k8s新增服务

常用命令

  • kubectl apply -f xxxxxx.yaml # 部署资源,顺序:namespace -> pvc -> deployment -> service
  • kubectl create namespace jupyter # 创建namespace
  • kubectl get namespaces # 查看ns
  • kubectl get pods -n jupyter # 查看pods
  • kubectl logs jupyterlab -n jupyter # 查看pod日志
  • kubectl get svc jupyter -n jupyter # 查看 svc 和 nodeport
  • kubectl get deployment -n jupyter # 查看 deployment
  • kubectl get pods -A # 查看所有ns下的pod
  • kubectl get all -n jupyter # 查看ns下的所有资源
  • kubectl describe [deployment|svc] jupyter -n jupyter # 详细信息,可以查看事件
  • kubectl edit deployment jupyter -n jupyter # 命令行编辑yaml,保存后立即生效
  • kubectl apply -f jupyter-deployment.yaml # 应用更新后的yaml

新增namespace

apiVersion: v1
kind: Namespace
metadata:name: jupyter
新增pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: jupyter-work-pvcnamespace: jupyter
spec:accessModes:- ReadWriteOnceresources:requests:storage: 10Gi

新增deployment

apiVersion: apps/v1
kind: Deployment
metadata:name: jupyternamespace: jupyter  # 假设你已经创建了 jupyter 这个 Namespace
spec:replicas: 1selector:matchLabels:app: jupytertemplate:metadata:labels:app: jupyterspec:containers:- name: jupyterimage: pyflink:20250109  # 安装了python notebook 的镜像securityContext:privileged: true  # 对应 docker-compose 的 privileged: trueports:- containerPort: 8888  # Jupyter Notebook 端口volumeMounts:- name: work-volumemountPath: /work     # 挂载 /work 目录command: ["/bin/sh", "-c"]args:- |cd /nohup jupyter notebook --ip 0.0.0.0 --port 8888 --allow-root --NotebookApp.password=sha1:6587feaef3b1:6b243404e4cfaafe611fdf494ee71fdaa8c4a563 2>&1 > /work/.jupyter.log &# 保持主进程运行tail -f /dev/nullresources:requests:cpu: "2000m"memory: "4Gi"limits:cpu: "4000m"memory: "8Gi"volumes:- name: work-volumepersistentVolumeClaim:claimName: jupyter-work-pvc  # 挂载 PVC(持久化 /work 目录)

新增service

apiVersion: v1
kind: Service
metadata:name: jupyternamespace: jupyter
spec:selector:app: jupyterports:- name: jupyter-portprotocol: TCPport: 8888targetPort: 8888type: NodePort  # 使用 NodePort 类型暴露服务
http://www.dtcms.com/a/274587.html

相关文章:

  • 7.11 dp 图
  • 企业IT管理——医院数据备份与存储制度模板
  • spring-ai RAG(Retrieval-Augmented Generation)
  • 【网络】Linux 内核优化实战 - net.netfilter.nf_conntrack_max
  • 【网络】Linux 内核优化实战 - net.netfilter.nf_conntrack_buckets
  • 基于深度学习的人类活动识别模型研究:HAR-DeepConvLG的设计与应用
  • C++,从汇编角度看《虚拟继承的邪恶》
  • 多模态联邦学习
  • STM32F103ZET6 TFTLCD显示图片
  • Docker构建银河麒麟arm架构redis镜像
  • Windows下基于docker desktop 使用Claude code
  • MySQL中使用group_concat遇到的问题及解决
  • 容器管理: 单机用Docker Compose,多机用Kubernetes
  • Docker高级管理--Dockerfile 镜像制作
  • 8.卷积神经网络基础
  • CSS 版本迭代历史和版本特性
  • ffmpeg-api记录
  • 8、鸿蒙Harmony Next开发:相对布局 (RelativeContainer)
  • PortsWiggerLab: Blind OS command injection with output redirection
  • 2D下的几何变换(C#实现,持续更新)
  • linux获取NTP方式
  • ubuntu22默认安装firefox使用snap安装还老打不开解决办法
  • 【Spring】拦截器详解
  • jenkins部署springboot+Docker项目
  • Playwright Python 教程:网页自动化
  • xAI发布Grok4+代码神器Grok4 Code,教你如何在国内升级订阅SuperGrok并使用到Grok4教程
  • 信号量机制
  • 【机器学习】保序回归平滑校准算法
  • 设计模式(结构型)-适配器模式
  • 深度学习入门教程(三)- 线性代数教程