minikube---具体的yaml,以及坑的解决

  1. deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: weixin
  namespace: test
  labels:
    app: weixin
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 50%
  template:
    metadata:
      labels:
        app: weixin
    spec:
      containers:
      - env:
            - name: SSH_PASS_WORD
              value: xxxxxxxxxx
            - name: SSH_KEY_PATH
              value: /home/weixin/ssh/id_rsa
        image: index.docker.io/zhulingbiezhi/weixin_auto_build:master
        name: weixin
        ports:
          - containerPort: 8080
        volumeMounts:
          - name: ssh-file
            mountPath: /home/weixin/ssh
        imagePullPolicy: Always
      restartPolicy: Always
      imagePullSecrets:
      - name: testkey
      volumes:
      - name: ssh-file
        hostPath:
           path: /Users/huhai/.ssh
  1. service.yaml
apiVersion: v1
kind: Service
metadata:
  name: weixin-service
  namespace: test
spec:
  type: NodePort
  ports:
 - port: 8080
    nodePort: 30000
  selector:
    app: weixin
  • 遇到问题如何解决
    1. 利用logs日志:
      kubectl logs $pod_name -n test
    2. 利用describe:
      kubectl logs pods/$pod_name -n test
    3. 利用minikube:
      minikube logs可以看到所有的日志

关于service的cluster IP和external IP
很多问题其实都会出现在还有namespace的问题上

  • 查看nodePort类型的service的对外端口(external IP)
    minikube service $service—name -n test --url

  • 查看service的cluster IP用于在pods之间访问
    kubectl get service --all-namespaces

你可能感兴趣的:(minikube---具体的yaml,以及坑的解决)