2017-03-14 3 views
0

실행중인 GCP Kubernetes 클러스터가 있습니다. 일부 서비스를 배포하고 kubectl expose ... type = "LoadBalancer"를 사용하여 성공적으로 노출 시켰습니다. 그러나 한 가지 새로운 서비스가 작동하지 않습니다. 확인해야 할 수천 가지 원인이있을 수 있지만 빌드하는 Docker 이미지가 매우 작아서 포드 나 컨테이너 내부의 kubectl exec를 통해 실행할 수있는 유용한 도구를 찾을 수 없습니다.Kubernetes - 연결 거부 진단

질문 : 가능한 모든 클러스터 도구 만 사용하는 내 진단 옵션은 무엇입니까? 어떤 종류의 로그를 검사 할 수 있습니까? 또는 어떤 환경 변수를 읽을 수 있습니까?

업데이트 :

$ 포드

NAME        READY  STATUS RESTARTS AGE 
helianto-mailer-1024769093-6407d 2/2  Running 0   6d 
helianto-spring-2246525676-l54p9 2/2  Running 0   6d 
iservport-shipfo-12873703-wrh37 2/2  Running 0   13h 

$는 포드 iservport-shipfo-12873703-wrh37

Name:   iservport-shipfo-12873703-wrh37 
Namespace:  default 
Node:   gke-iservport01-default-pool-xxx/xx.xx.xx.xx 
Start Time:  Tue, 14 Mar 2017 17:28:18 -0300 
Labels:   app=SHIPFO 
       pod-template-hash=12873703 
Status:   Running 
IP:    yy.yy.yy.yy 
Controllers: ReplicaSet/iservport-shipfo-12873703 
Containers: 
    iservport-shipfo: 
    Container ID:   docker://... 
Image:    us.gcr.io/mvps-156214/iservport-xxx 
Image ID:   docker://... 
    Port:    8085/TCP 
    Requests: 
     cpu:    100m 
    State:    Running 
     Started:   Tue, 14 Mar 2017 17:28:33 -0300 
    Ready:    True 
    Restart Count:  0 
    Volume Mounts: 
     /var/run/secrets/kubernetes.io/serviceaccount from default-token-mmeza (ro) 
    Environment Variables: 
    SPRING_PROFILES_ACTIVE: gcp 
     HELIANTO_MAILER_URL:  http://10.35.254.197:8082 
    cloudsql-proxy: 
    Container ID:  docker://... 
    Image:    b.gcr.io/cloudsql-docker/gce-proxy:1.05 
    Image ID:   docker://... 
    Port:    
    Command: 
    /cloud_sql_proxy 
    --dir=/cloudsql 
    -instances=mvps-156214:us-east1-b:helianto01=tcp:3306 
    -credential_file=/secrets/cloudsql/credentials.json 
    Requests: 
     cpu:    100m 
    State:    Running 
     Started:   Tue, 14 Mar 2017 17:28:33 -0300 
    Ready:    True 
    Restart Count:  0 
    Volume Mounts: 
     /cloudsql from cloudsql (rw) 
     /etc/ssl/certs from ssl-certs (rw) 
     /secrets/cloudsql from cloudsql-oauth-credentials (ro) 
     /var/run/secrets/kubernetes.io/serviceaccount from default-token-mmeza (ro) 
    Environment Variables:  <none> 
Conditions: 
Type   Status 
    Initialized True 
    Ready   True 
    PodScheduled True 
Volumes: 
    cloudsql-oauth-credentials: 
    Type:  Secret (a volume populated by a Secret) 
    SecretName: cloudsql-oauth-credentials 
    ssl-certs: 
    Type:  HostPath (bare host directory volume) 
    Path:  /etc/ssl/certs 
    cloudsql: 
    Type:  EmptyDir (a temporary directory that shares a pod's lifetime) 
    Medium:  
    default-token-mmeza: 
    Type:  Secret (a volume populated by a Secret) 
    SecretName: default-token-mmeza 
QoS Class:  Burstable 
Tolerations: <none> 
No events. 

은 $가 SVC에게

를 얻을 kubectl 설명 kubectl 얻을 kubectl
NAME      CLUSTER-IP  EXTERNAL-IP  PORT(S)      AGE 
helianto-mailer-service 10.35.254.197 <nodes>   443:32178/TCP,80:30771/TCP 12d 
helianto-spring   10.35.241.27 xxx.xxx.xxx.xxx 80:30974/TCP     52d 
iservport-shipfo   10.35.240.129 xx.xxx.xxx.xxx 80:32598/TCP     14h 
kubernetes    10.35.240.1  <none>   443/TCP      53d 

$ SVC의 iservport-shipfo에게

Name:     iservport-shipfo 
Namespace:    default 
Labels:     app=SHIPFO 
Selector:    app=SHIPFO 
Type:     LoadBalancer 
IP:      10.35.240.129 
LoadBalancer Ingress: xx.xxx.xxx.xxx 
Port:     <unset> 80/TCP 
NodePort:    <unset> 32598/TCP 
Endpoints:    10.32.4.26:8085 
Session Affinity:  None 
No events. 

답변

0

당신은는 Kubernetes 노동자 호스트에 연결하고보기의 호스트 지점에서 이후,이 진단을 할 수있는을 설명 kubectl은 용기 만 였는지를하다 .

+0

좋은 점, gcloud는 ssh xxx helped를 계산합니다. 그러나 연결이 끊어진 이유를 찾지 못했습니다. –

2

서비스가 http 포트에서 응답하는지 확인해야합니다. 어쩌면 포드에서 데스크톱 로컬로 포트 포워드를 할 수 있습니다. 아래 명령에서 pod_name, pod_port 및 local_port 값을 대체하십시오. 이 후

kubectl port-forward <pod_name> <local_port>:<pod_port>

, 액세스 http://localhost:local_port 및 경우 반환 뭔가를 확인합니다. 이렇게하면 응용 프로그램이 응답하는지 확인할 수 있습니다.