zoukankan      html  css  js  c++  java
  • K8S

    httpGet 指针

    apiVersion: v1
    kind: Pod
    metadata:
      name: liveness-httpget-pod
      namespace: default
    spec:
      containers:
      - name: liveness-httpget-container
        image: busybox:latest
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh","-c","mkdir -p /data/web/html; echo 'abc' > /data/web/html/index.html; /bin/httpd -f -h /data/web/html"]
        livenessProbe:
          httpGet:
            port: 80
            path: /index.html
          initialDelaySeconds: 1
          periodSeconds: 3
    

     POD

    apiVersion: apps/v1
    # POD名字
    kind: ReplicaSet
    metadata:
        name: myapp
        # 放入那个名称空间
        namespace: default
    spec:
        replicas: 2
        selector:
            matchLabels:
                app: myapp
                release: canary
        template:
            metadata:
                name: myapp-pod
                labels:
                    app: myapp
                    release: canary
                    environment: qa
            spec:
                containers:
                - name: myapp-container
                  image: ikubernetes/myapp:v1
                  ports:
                  - name: http
                    containerPort: 80
    
     1 apiVersion: v1
     2 kind: Service
     3 metadata:
     4     name: myapp
     5     namespace: default
     6 
     7 spec:
     8     selector:
     9         app: myapp
    10         release: canary
    11     clusterIP: 10.99.99.99
    12     type: NodePort
    13     ports:
    14     - port: 80
    15       targetPort: 80
    16       nodePort: 30080

    #查看所解析的地址

    dig -t A myapp-svc.default.svc.cluster.local. @10.96.0.10

    #查看本机的kube=DNS地址

     kubectl get svc -n kube-system

    # 修改server访问只用一台去轮训,None是取消一台,让所有的pod继续轮训。

    kubectl patch svc myapp -p '{"spec":{"sessionAffinity":"ClientIP"}}'

    kubectl patch svc myapp -p '{"spec":{"sessionAffinity":"None"}}'

  • 相关阅读:
    【转载】两军问题与Paxos算法 & 动画讲解Paxos算法
    hdu4611 Balls Rearrangement
    [置顶] github简单使用
    set与map容器
    [置顶] C++为什么是C++而不是++C
    HDU 4616 Game (搜索)、(树形dp)
    Just learn how to use the JNI
    HDU 4611 Balls Rearrangement (数学-思维逻辑题)
    冒泡排序改进
    Python基础
  • 原文地址:https://www.cnblogs.com/zhaobin-diray/p/13025833.html
Copyright © 2011-2022 走看看