当前位置: 首页 > 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.lryc.cn/news/585759.html

相关文章:

  • 中国国际会议会展中心模块化解决方案的技术经济分析报告
  • 【机器学习应用】基于集成学习的电力负荷预测系统实战案例
  • Linux设备树(dts/dtsi/dtb、设备树概念,设备树解析,驱动匹配)
  • kubernetes单机部署踩坑笔记
  • 【linux网络】深入理解 TCP/UDP:从基础端口号到可靠传输机制全解析
  • 【理念●体系】Windows AI 开发环境搭建实录:六层架构的逐步实现与路径治理指南
  • ATAM与效用树:架构评估的核心方法论
  • 鸿蒙 Secure Boot 全流程解析:从 BootROM 到内核签名验证的实战指南
  • 使用 lstrip() 和 rstrip() 方法
  • OpenAI 将推 AI Agent 浏览器:挑战 Chrome,重塑上网方式
  • C语言文件读写操作详解:fgetc与feof函数的应用
  • 上位机知识篇---Git符号链接
  • vue3 el-input 通过数组 获取显示
  • 【构建Tomcat版本检查工具:自动检测并提醒版本更新】
  • [面试] 手写题-插入排序
  • Redis命令参考手册
  • (C++)set集合相关知识(STL标准库)(C++教程)(set集合基础教程)
  • 供应链管理-计划:产能策略
  • 匿名函数作递归函数引用
  • 声明式 vs 编程式:Spring事务管理全对比
  • Prometheus+Grafana部署及企业微信邮件/群消息告警通知配置
  • linux系统-----Redis数据库基础
  • 迭代器(c++)、智能指针
  • LDO选型
  • Rust基础-part2-变量和可变类型
  • LVS-NAT模式配置
  • 期望和方差的计算
  • 深度学习×第8卷:优化器与训练流程进阶——她开始跑起来,学着一次次修正自己
  • 深度体验飞算JavaAI:一场Java开发效率的革命
  • 百度2026届校招开启,大规模发力AI的百度未来何在?