设为首页 收藏本站
查看: 575|回复: 0

[经验分享] kubernetes V1.10.4 单节点部署 (手动生成证书)

[复制链接]

尚未签到

发表于 2018-9-15 12:18:24 | 显示全部楼层 |阅读模式
---  

  
apiVersion: v1
  
kind: Namespace
  
metadata:
  
  name: ingress-nginx
  
---
  

  
apiVersion: extensions/v1beta1
  
kind: Deployment
  
metadata:
  
  name: default-http-backend
  
  labels:
  
    app: default-http-backend
  
  namespace: ingress-nginx
  
spec:
  
  replicas: 1
  
  selector:
  
    matchLabels:
  
      app: default-http-backend
  
  template:
  
    metadata:
  
      labels:
  
        app: default-http-backend
  
    spec:
  
      terminationGracePeriodSeconds: 60
  
      containers:
  
      - name: default-http-backend
  
        # Any image is permissible as long as:
  
        # 1. It serves a 404 page at /
  
        # 2. It serves 200 on a /healthz endpoint
  
        image: registry.cn-hangzhou.aliyuncs.com/googles_containers/defaultbackend:1.4
  
        livenessProbe:
  
          httpGet:
  
            path: /healthz
  
            port: 8080
  
            scheme: HTTP
  
          initialDelaySeconds: 30
  
          timeoutSeconds: 5
  
        ports:
  
        - containerPort: 8080
  
        resources:
  
          limits:
  
            cpu: 10m
  
            memory: 20Mi
  
          requests:
  
            cpu: 10m
  
            memory: 20Mi
  
---
  

  
apiVersion: v1
  
kind: Service
  
metadata:
  
  name: default-http-backend
  
  namespace: ingress-nginx
  
  labels:
  
    app: default-http-backend
  
spec:
  
  ports:
  
  - port: 80
  
    targetPort: 8080
  
  selector:
  
    app: default-http-backend
  
---
  

  
kind: ConfigMap
  
apiVersion: v1
  
metadata:
  
  name: nginx-configuration
  
  namespace: ingress-nginx
  
  labels:
  
    app: ingress-nginx
  
---
  

  
kind: ConfigMap
  
apiVersion: v1
  
metadata:
  
  name: tcp-services
  
  namespace: ingress-nginx
  
---
  

  
kind: ConfigMap
  
apiVersion: v1
  
metadata:
  
  name: udp-services
  
  namespace: ingress-nginx
  
---
  

  
apiVersion: v1
  
kind: ServiceAccount
  
metadata:
  
  name: nginx-ingress-serviceaccount
  
  namespace: ingress-nginx
  

  
---
  

  
apiVersion: rbac.authorization.k8s.io/v1beta1
  
kind: ClusterRole
  
metadata:
  
  name: nginx-ingress-clusterrole
  
rules:
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - configmaps
  
      - endpoints
  
      - nodes
  
      - pods
  
      - secrets
  
    verbs:
  
      - list
  
      - watch
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - nodes
  
    verbs:
  
      - get
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - services
  
    verbs:
  
      - get
  
      - list
  
      - watch
  
  - apiGroups:
  
      - "extensions"
  
    resources:
  
      - ingresses
  
    verbs:
  
      - get
  
      - list
  
      - watch
  
  - apiGroups:
  
      - ""
  
    resources:
  
        - events
  
    verbs:
  
        - create
  
        - patch
  
  - apiGroups:
  
      - "extensions"
  
    resources:
  
      - ingresses/status
  
    verbs:
  
      - update
  

  
---
  

  
apiVersion: rbac.authorization.k8s.io/v1beta1
  
kind: Role
  
metadata:
  
  name: nginx-ingress-role
  
  namespace: ingress-nginx
  
rules:
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - configmaps
  
      - pods
  
      - secrets
  
      - namespaces
  
    verbs:
  
      - get
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - configmaps
  
    resourceNames:
  
      # Defaults to "-"
  
      # Here: "-"
  
      # This has to be adapted if you change either parameter
  
      # when launching the nginx-ingress-controller.
  
      - "ingress-controller-leader-nginx"
  
    verbs:
  
      - get
  
      - update
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - configmaps
  
    verbs:
  
      - create
  
  - apiGroups:
  
      - ""
  
    resources:
  
      - endpoints
  
    verbs:
  
      - get
  

  
---
  

  
apiVersion: rbac.authorization.k8s.io/v1beta1
  
kind: RoleBinding
  
metadata:
  
  name: nginx-ingress-role-nisa-binding
  
  namespace: ingress-nginx
  
roleRef:
  
  apiGroup: rbac.authorization.k8s.io
  
  kind: Role
  
  name: nginx-ingress-role
  
subjects:
  
  - kind: ServiceAccount
  
    name: nginx-ingress-serviceaccount
  
    namespace: ingress-nginx
  

  
---
  

  
apiVersion: rbac.authorization.k8s.io/v1beta1
  
kind: ClusterRoleBinding
  
metadata:
  
  name: nginx-ingress-clusterrole-nisa-binding
  
roleRef:
  
  apiGroup: rbac.authorization.k8s.io
  
  kind: ClusterRole
  
  name: nginx-ingress-clusterrole
  
subjects:
  
  - kind: ServiceAccount
  
    name: nginx-ingress-serviceaccount
  
    namespace: ingress-nginx
  
---
  

  
apiVersion: extensions/v1beta1
  
kind: Deployment
  
metadata:
  
  name: nginx-ingress-controller
  
  namespace: ingress-nginx
  
spec:
  
  replicas: 1
  
  selector:
  
    matchLabels:
  
      app: ingress-nginx
  
  template:
  
    metadata:
  
      labels:
  
        app: ingress-nginx
  
      annotations:
  
        prometheus.io/port: '10254'
  
        prometheus.io/scrape: 'true'
  
    spec:
  
      hostNetwork: true
  
      serviceAccountName: nginx-ingress-serviceaccount
  
      containers:
  
        - name: nginx-ingress-controller
  
          image: registry.cn-hangzhou.aliyuncs.com/google_containers/nginx-ingress-controller:0.15.0
  
          args:
  
            - /nginx-ingress-controller
  
            - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
  
            - --configmap=$(POD_NAMESPACE)/nginx-configuration
  
            - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
  
            - --udp-services-configmap=$(POD_NAMESPACE)/udp-services
  
            - --publish-service=$(POD_NAMESPACE)/ingress-nginx
  
            - --annotations-prefix=nginx.ingress.kubernetes.io
  
          env:
  
            - name: POD_NAME
  
              valueFrom:
  
                fieldRef:
  
                  fieldPath: metadata.name
  
            - name: POD_NAMESPACE
  
              valueFrom:
  
                fieldRef:
  
                  fieldPath: metadata.namespace
  
          ports:
  
          - name: http
  
            containerPort: 80
  
          - name: https
  
            containerPort: 443
  
          livenessProbe:
  
            failureThreshold: 3
  
            httpGet:
  
              path: /healthz
  
              port: 10254
  
              scheme: HTTP
  
            initialDelaySeconds: 10
  
            periodSeconds: 10
  
            successThreshold: 1
  
            timeoutSeconds: 1
  
          readinessProbe:
  
            failureThreshold: 3
  
            httpGet:
  
              path: /healthz
  
              port: 10254
  
              scheme: HTTP
  
            periodSeconds: 10
  
            successThreshold: 1
  
            timeoutSeconds: 1
  
          securityContext:
  
            runAsNonRoot: false
  
---
  

  
apiVersion: v1
  
kind: Service
  
metadata:
  
  name: ingress-nginx
  
  namespace: ingress-nginx
  
spec:
  
  type: NodePort
  
  ports:
  
  - name: http
  
    port: 80
  
    targetPort: 80
  
    protocol: TCP
  
  - name: https
  
    port: 443
  
    targetPort: 443
  
    protocol: TCP
  
  selector:
  
    app: ingress-nginx



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-583532-1-1.html 上篇帖子: 手动安装K8s第四节:Master节点 下篇帖子: kubernetes环境下 创建pod过程中 异常信息总结整理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表