zoukankan      html  css  js  c++  java
  • k8s学习

     kubectl exec -it ds-test-m9mrh bash

    进入到某个pod里面 
    kubectl exec -it ds-test-m9mrh bash

    job.yaml

     kubectl create -f .job.yaml

    apiVersion: batch/v1
    kind: Job
    metadata:
      name: pi
    spec:
      template:
        spec:
          containers:
            - name: pi
              image: harbor.dcos.guangzhou.unicom.local/topia-zoo/perl:latest
              command: ["perl","-Mbignum=bpi","-wle","print bpi(2000)"]
          restartPolicy: Never
      backoffLimit: 4

    kubectl logs pi-6fqxq

    cronjob.yaml

    apiVersion: batch/v1beta1
    kind: CronJob
    metadata:
      name: hello
    spec:
      schedule: "*/1 * * * *"
      jobTemplate:
        spec:
          template:
            spec:
              containers:
                - name: hello
                  image: harbor.dcos.guangzhou.unicom.local/common/busybox:test
                  args:
                    - /bin/sh
                    - -c
                    - date; echo Hello from the Kubernates cluster
              restartPolicy: OnFailure

     secret.yaml

    apiVersion: v1
    kind: Secret
    metadata:
      name: mysecret
    type: Opaque
    data:
      username: YWRtaW4=
      password: MTIzNDU2

     以变量形式挂载到容器中

    apiVersion: v1
    kind: Pod
    metadata:
      name: mypod
    spec:
      containers:
        - name: nginx
          image: harbor.dcos.guangzhou.unicom.local/common/nginx:latest
          env:
            - name: SECRET_USERNAME
              valueFrom:
                secretKeyRef:
                  name: mysecret
                  key: username
            - name: SECRET_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysecret
                  key: password

     3.创建角色 rbac-role.yaml

    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      namespace: roledemo
      name: pod-reader
    rules:
       - apiGroups: [""]  # "" indicate the core API group
         resources: ["pods"]
         verbs: ["get","watch","list"]

  • 相关阅读:
    74. Search a 2D Matrix(js)
    73. Set Matrix Zeroes(js)
    72. Edit Distance(js)
    71. Simplify Path(js)
    兼容各种浏览器版本的事件绑定函数?
    浏览器兼容性问题
    柯里化函数
    token登录验证机制
    vue懒加载
    在Vue中使用了Swiper ,动态从后台获取数据的之后,swiper滑动失效??
  • 原文地址:https://www.cnblogs.com/huanglei2010/p/13973306.html
Copyright © 2011-2022 走看看