nginx访问jupyter
现在jupyter已通过k8s安装完成,并通过nodeport暴露出来。
如果不能直接访问这个nodeport(像我在的公司)或是希望能组织好jupyter实例,
那应该如何调通呢?
这里包括两个技术点:
一,jupyter本身需要允许指定ip的访问。
红色部分,继承了docker镜像的cmd,并新增了--NotebookApp.allow_origin='*'参数,不然,nginx跳过去,jypyter不接受。
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-jupyter
spec:
replicas: 1
selector:
matchLabels:
name: ai-jupyter
template:
metadata:
labels:
name: ai-jupyter
spec:
imagePullSecrets:
- name: xxxx
nodeSelector:
accelerator: nvidia-tesla-k80
containers:
- name: sis-ai-jupyter
image: harbor.xxxx.com.cn/3rd_part/tensorflow:1.14.0-gpu-py3-jupyter
imagePullPolicy: IfNotPresent
command: ["bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.allow_origin='*'"]
resources:
limits:
nvidia.com/gpu: 2
---
apiVersion: v1
kind: Service
metadata:
name: ai-jupyter
spec:
type: NodePort
ports:
- port: 8888
targetPort: 8888
nodePort: 30302
selector:
name: ai-jupyter
二,nginx需要有websocket的升级处理。
红色部分,对kernels和terminals两个目录的连接,作了ws升级处理。
upstream ai_jupyter {
ip_hash;
server 1.2.3.4:30302;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X-FORWARDED-FOR $remote_addr;
proxy_pass http://ai_jupyter;
}
location ~ /api/kernels/ {
proxy_pass http://ai_jupyter;
proxy_set_header Host $host;
# websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
location ~ /terminals/ {
proxy_pass http://ai_jupyter;
proxy_set_header Host $host;
# websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}
nginx访问jupyter的更多相关文章
- Nginx 访问日志轮询切割
Nginx 访问日志轮询切割脚本 #!/bin/sh Dateformat=`date +%Y%m%d` Basedir="/application/nginx" Nginxlog ...
- 按日期切割nginx访问日志--及性能优化
先谈下我们需求,一个比较大的nginx访问日志,根据访问日期切割日志,保存在/tmp目录下. 测试机器为腾讯云机子,单核1G内存.测试日志大小80M. 不使用多线程版: #!/usr/bin/env ...
- 一、基于hadoop的nginx访问日志分析---解析日志篇
前一阵子,搭建了ELK日志分析平台,用着挺爽的,再也不用给开发拉各种日志,节省了很多时间. 这篇博文是介绍用python代码实现日志分析的,用MRJob实现hadoop上的mapreduce,可以直接 ...
- Python正则表达式,统计分析nginx访问日志
目标: 1.正则表达式 2.oop编程,统计nginx访问日志中不同IP地址出现的次数并排序 1.正则表达式 #!/usr/bin/env python # -*- coding: utf-8 -*- ...
- linux端安装Anaconda,方便远端访问jupyter
ipython notebook是一个基于浏览器的python数据分析工具,使用起来非常方便,具有极强的交互方式和富文本的展示效果.jupyter是它的升级版,它的安装也非常方便,一般Anaconda ...
- Nginx访问控制模块
一.Nginx访问控制模块 Nginx默认安装的模块http_access_module,可以基于来源IP进行访问控制. 1.模块安装 nginx中内置ngx_http_access_module,除 ...
- logstash收集nginx访问日志
logstash收集nginx访问日志 安装nginx #直接yum安装: [root@elk-node1 ~]# yum install nginx -y 官方文档:http://nginx.org ...
- 使用python找出nginx访问日志中访问次数最多的10个ip排序生成网页
使用python找出nginx访问日志中访问次数最多的10个ip排序生成网页 方法1:linux下使用awk命令 # cat access1.log | awk '{print $1" &q ...
- nginx访问不到
nginx访问不到 今天,一朋友的一台linux服务器上部署了nginx,但是外部(公网)就是不能访问,于是协助其排查.整体思路如下: 1.确认nginx配置是否ok. 2.确认网络是否可达. 3.是 ...
随机推荐
- MySQL实战45讲学习笔记:第二十六讲
一.引子 在上一篇文章中,我和你介绍了几种可能导致备库延迟的原因.你会发现,这些场景里,不论是偶发性的查询压力,还是备份,对备库延迟的影响一般是分钟级的,而且在备库恢复正常以后都能够追上来. 但是,如 ...
- oracle--DG模式备库归档缺失问题(1)
01.问题描述 备库的归档日志没有增加,一直等待一个 查询问题: SQL> SELECT * FROM V$ARCHIVE_GAP; THREAD# LOW_SEQUENCE# HIGH_SEQ ...
- c# CRC16位校验辅助类
public class CRC16Helper { /// <summary> /// CRC校验 /// </summary> /// <param name=&qu ...
- mybatis使用associaton进行分步查询
Employee类 public class Employee { private Integer id; private String lastName; private String email; ...
- thinkphp的普通查询与表达式查询
一.普通查询方式 a.字符串:$arr=$m->where("sex=0 and username='gege'")->find();//字符串需要加引号 b.数组 $ ...
- JAVA PTA 7-1 作品评分 (10 分)
全国中小学生Scratch作品大赛拉开了序幕.每个参赛选手可以通过网络直接上传作品.本次比赛人人可做评委.每个网络评委可以通过网络对每一件作品进行打分.评分系统也是请程序高手设计的,能自动去掉一个最高 ...
- HTML+css基础 三大列表
三大列表: 1.无序列表 ul 标签属性type 决定项目符号的类型 disc(实心圆)square (方形) circle 空心圆 里面的子标签是li 2.有序列表 ol t ...
- RabbitMQ实例C#
驱动组件.NET版本 官网推荐驱动:RabbitMQ.Client https://www.rabbitmq.com/devtools.html#dotnet-dev Connection和Chann ...
- 《 .NET并发编程实战》阅读指南 - 第9章
先发表生成URL以印在书里面.等书籍正式出版销售后会公开内容.
- Storm 系列(九)—— Storm 集成 Kafka
一.整合说明 Storm 官方对 Kafka 的整合分为两个版本,官方说明文档分别如下: Storm Kafka Integration : 主要是针对 0.8.x 版本的 Kafka 提供整合支持: ...