0

Hi all i have master node in digital ocean and worker node in google cloud, nodes are connected using public ip of master nodeenter image description here and pods are in running status but when i run kubectl logs i'm getting timeout error , also i noticed log is calling with local ip so there is no host in it , any one help on this ? is there any possible way to call logs using public ip ?

Update: adding /etc/kubernetes/manifests/kube-apiserver.yaml

apiVersion: v1 kind: Pod metadata: annotations: kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 104.248.40.128:6443 creationTimestamp: null labels: component: kube-apiserver tier: control-plane name: kube-apiserver namespace: kube-system spec: containers:

  • command:
    • kube-apiserver
    • --advertise-address=104.248.40.128
    • --allow-privileged=true
    • --authorization-mode=Node,RBAC
    • --client-ca-file=/etc/kubernetes/pki/ca.crt
    • --enable-admission-plugins=NodeRestriction
    • --enable-bootstrap-token-auth=true
    • --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
    • --etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt
    • --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key
    • --etcd-servers=https://127.0.0.1:2379
    • --kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt
    • --kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key
    • --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
    • --proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt
    • --proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key
    • --requestheader-allowed-names=front-proxy-client
    • --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
    • --requestheader-extra-headers-prefix=X-Remote-Extra-
    • --requestheader-group-headers=X-Remote-Group
    • --requestheader-username-headers=X-Remote-User
    • --secure-port=6443
    • --service-account-issuer=https://kubernetes.default.svc.cluster.local
    • --service-account-key-file=/etc/kubernetes/pki/sa.pub
    • --service-account-signing-key-file=/etc/kubernetes/pki/sa.key
    • --service-cluster-ip-range=10.96.0.0/12
  • --tls-cert-file=/etc/kubernetes/pki/apiserver.crt
    • --tls-private-key-file=/etc/kubernetes/pki/apiserver.key image: registry.k8s.io/kube-apiserver:v1.26.3 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 8 httpGet: host: 104.248.40.128 path: /livez port: 6443 scheme: HTTPS initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 name: kube-apiserver readinessProbe: failureThreshold: 3 httpGet: host: 104.248.40.128 path: /readyz port: 6443 scheme: HTTPS periodSeconds: 1 timeoutSeconds: 15 resources: requests: cpu: 250m startupProbe: failureThreshold: 24 httpGet: host: 104.248.40.128 path: /livez port: 6443 scheme: HTTPS initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 volumeMounts:
    • mountPath: /etc/ssl/certs name: ca-certs readOnly: true
    • mountPath: /etc/pki name: etc-pki readOnly: true
    • mountPath: /etc/kubernetes/pki name: k8s-certs readOnly: true hostNetwork: true priorityClassName: system-node-critical securityContext: seccompProfile: type: RuntimeDefault volumes:
    • hostPath: path: /etc/ssl/certs type: DirectoryOrCreate name: ca-certs
    • hostPath: path: /etc/pki type: DirectoryOrCreate name: etc-pki
    • hostPath: path: /etc/kubernetes/pki type: DirectoryOrCreate name: k8s-certs status: {}

kubectl get endpoints gives below NAME ENDPOINTS AGE kubernetes 104.248.40.128:6443 34h webserver-simple-service 10.244.1.7:8000,10.244.1.8:8000 33h

Thom
  • 101
  • 1
  • `Thom` can you check whether your public IP got reflected in your config, the following command will help you in finding that **kubectl config view** . If your kube-api-endpoint is pointing to your internal IP you can follow this [blog](https://ystatit.medium.com/deploy-kubernetes-with-specific-public-ip-address-for-control-plane-endpoint-cef1a54b2fbf) written by **Yst@IT** for changing your kube-api-endpoint to public IP. – Kranthiveer Dontineni Mar 30 '23 at 05:40
  • 1
    @KranthiveerDontineni i have checked kubectl config view the server: https://104.248.40.128:6443 it's a public ip and api is working in browser also , but only thing i noticed it's not have valid ssl certificate dose it make problem ? – Thom Mar 30 '23 at 06:15
  • have you used SSL certificate while creating the kubernetes cluster..? If so then it might cause issues, so you need to use a valid SSL either it might be a self signed one or OpenSSL based one or from some other third party. – Kranthiveer Dontineni Mar 30 '23 at 06:28
  • also can you provide steps or document that you are following so that we can try to replicate the issue and provide a better solution. – Kranthiveer Dontineni Mar 30 '23 at 06:33
  • 1
    i have followed this article https://dev.to/kcdchennai/create-a-multi-cloud-setup-of-kubernetes-cluster-936 – Thom Mar 30 '23 at 06:35
  • can you try querying the logs by passing the endpoint parameter..? kubectl logs --endpoint=http://104.248.40.128:6443 or change port number to 10250 – Kranthiveer Dontineni Mar 30 '23 at 07:15
  • it says error: unknown flag: --endpoint – Thom Mar 30 '23 at 07:19
  • can you provide what is available in `/etc/kubernetes/manifests/kube-apiserver.yaml` and also the output of **kubectl get endpoints** command – Kranthiveer Dontineni Mar 30 '23 at 07:45
  • @KranthiveerDontineni i have updated the yaml and endpoint details in the question , kindly check it – Thom Mar 31 '23 at 04:12
  • all the kubernetes looks fine can you check the firewall rules for this public IP – Kranthiveer Dontineni Mar 31 '23 at 05:27
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/144994/discussion-between-kranthiveer-dontineni-and-thom). – Kranthiveer Dontineni Mar 31 '23 at 05:27

0 Answers0