[k8s]pod调度-不完整版本-及dashboard原理
2017-08-15 10:38
651 查看
https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
先决: crontab需要用到这个版的api,将下面的添加到api的配置
创建crontab
也可以这样运行一个crontab
After creating the cron job, get its status using this command:
As you can see above, there’s no active job yet, and no job has been scheduled, either.
Watch for the job to be created in around one minute:
You should see that “hello” successfully scheduled a job at the time specified in LAST-SCHEDULE. There are curre
4000
ntly 0 active jobs, meaning that the job that’s scheduled is completed or failed.
Now, find the pods created by the job last scheduled and view the standard output of one of the pods. Note that your job name and pod name would be different.
删除crontab.
有个疑问,就是crontab没执行起来,
todo:
滚动升级
rc
demployment
pod调用
crontab job daemon staticpod这些特殊的pod
nodeselect
亲和度
还有个没太理解的问题就是dashboard, dashboard访问的是api的https接口?如果集群没配证书怎么搞?
这里懂了
dashboard的yml里有配置api地址的地方,这里架构选用单独一台nginx做vip即api地址.
关于trafix和dashboard的认证,这里指的是界面的认证.
参考:https://github.com/kubernetes/dashboard/blob/master/docs/user-guide/troubleshooting.md
普通访问:
In the diagram below you can see the full authentication flow with all options, starting with the browser on the lower left hand side.
deployment下发过程
可以通过查看event看到.crontab
类似linux定时任务.先决: crontab需要用到这个版的api,将下面的添加到api的配置
--runtime-config=batch/v2alpha1=true
创建crontab
apiVersion: batch/v2alpha1 kind: CronJob metadata: name: hello spec: schedule: "*/1 * * * *" jobTemplate: spec: template: spec: containers: - name: hello image: busybox args: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure
kubectl create -f crontab.yml
也可以这样运行一个crontab
kubectl run hello --schedule="*/1 * * * *" --restart=OnFailure --image=busybox -- /bin/sh -c "date; echo Hello from the Kubernetes cluster" cronjob "hello" created
After creating the cron job, get its status using this command:
$ kubectl get cronjob hello NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE hello */1 * * * * False 0 <none>
As you can see above, there’s no active job yet, and no job has been scheduled, either.
Watch for the job to be created in around one minute:
$ kubectl get jobs --watch NAME DESIRED SUCCESSFUL AGE hello-4111706356 1 1 2s Now you’ve seen one running job scheduled by “hello”. We can stop watching it and get the cron job again: $ kubectl get cronjob hello NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE hello */1 * * * * False 0 Mon, 29 Aug 2016 14:34:00 -0700
You should see that “hello” successfully scheduled a job at the time specified in LAST-SCHEDULE. There are curre
4000
ntly 0 active jobs, meaning that the job that’s scheduled is completed or failed.
Now, find the pods created by the job last scheduled and view the standard output of one of the pods. Note that your job name and pod name would be different.
# Replace "hello-4111706356" with the job name in your system $ pods=$(kubectl get pods --selector=job-name=hello-4111706356 --output=jsonpath={.items..metadata.name}) $ echo $pods hello-4111706356-o9qcm $ kubectl logs $pods Mon Aug 29 21:34:09 UTC 2016 Hello from the Kubernetes cluster
删除crontab.
有个疑问,就是crontab没执行起来,
todo:
滚动升级
rc
demployment
pod调用
crontab job daemon staticpod这些特殊的pod
nodeselect
亲和度
还有个没太理解的问题就是dashboard, dashboard访问的是api的https接口?如果集群没配证书怎么搞?
这里懂了
dashboard的yml里有配置api地址的地方,这里架构选用单独一台nginx做vip即api地址.
关于trafix和dashboard的认证,这里指的是界面的认证.
参考:https://github.com/kubernetes/dashboard/blob/master/docs/user-guide/troubleshooting.md
普通访问:
+-------------+ user +-------------+ service +-------------+ | | authentication | | authentication | | | browser +------------------->+ apiserver +<-------------------+ dashboard | | | | | | | +-------------+ +-------------+ +-------------+
In the diagram below you can see the full authentication flow with all options, starting with the browser on the lower left hand side.
Workstation Kubernetes +------------------+ +----------------------------------------------------+ | | | | | | | | | +------------+ | | +------------+ apiserver +------------+ | | | | | authentication with kubectl | | | proxy | | | | | kubectl +------------------------------------>+ apiserver +------------------->+ dashboard | | | | proxy | | | | | | | | | | | | | | | | | | | +--------+---+ | | | | | | | | ^ | +------>+ | service account/ | | | | localhost| | | | | | kubeconfig | | | | | | | | | +<-------------------+ | | | +--------+---+ | | | | | | | | | | | | direct access | | +------------+ +------+-----+ | | | browser +-----------------------------+ | | | | | | | | | | | | +----------------------------------------------------------------------------->O | | +------------+ | bypass apiserver | NodePort | | | | | | | | | +------------------+ +----------------------------------------------------+
相关文章推荐
- [k8s]zookeeper集群在k8s的搭建(statefulset模式)-pod的调度
- viewport手机逻辑像素与物理像素原理(附完整手机各版本尺寸)
- Mapreduce 运行原理(针对使用YARN作为调度和管理的版本)
- 你的程序支持复杂的时间调度嘛?如约而来的 java 版本
- 获取版本信息Version的完整代码(从msdn扩展而来)
- java多线程分块上传并支持断点续传最新修正完整版本
- linux各个文件夹代表的意义(最完整版本)
- 利用Java针对MySql封装的jdbc框架类 JdbcUtils 完整实现(包含增删改查、JavaBean反射原理,附源码)
- PHP版本--HTTP session cookie原理及应用
- 各种变换的原理----DX版本
- GitLab完整搭建(版本6.3.1)
- 网络编程 -- RPC实现原理 -- Netty -- 迭代版本V2 -- 对象传输
- 完整的简单的Annotation版本的hibernate
- 网络编程 -- RPC实现原理 -- RPC -- 迭代版本V3 -- 远程方法调用 整合 Spring
- Ubuntu 完整升级 OpenResty 版本
- Kubernetes之Pod调度
- cocopods 升级和选择安装版本
- 完整版本:ISA 2004初学者禁止QQ上网详解
- [完整代码]创建不受数据库限制的报表 VB.Net 版本 -2
- MySQL数据库InnoDB存储引擎多版本控制(MVCC)实现原理分析