hello everyone Anyone who has any idea about this ...
# troubleshooting
m
hello everyone Anyone who has any idea about this error?
Copy code
...
WARN  io.fabric8.kubernetes.client.Config                          [] - Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
WARN  io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager [] - Exec Failure: HTTP 401, Status: 401 - Unauthorized
...
ERROR org.apache.flink.runtime.resourcemanager.active.ActiveResourceManager [] - Fatal error occurred in ResourceManager.
org.apache.flink.runtime.resourcemanager.exceptions.ResourceManagerException: Could not start the ResourceManager akka.tcp://flink@flink-cluster.flink:6123/user/rpc/resourcemanager_1
...
Caused by: org.apache.flink.runtime.resourcemanager.exceptions.ResourceManagerException: Cannot initialize resource provider.
...
Caused by: java.util.concurrent.CompletionException: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://10.133.14.10/api/v1/namespaces/flink/pods?labelSelector=app%3Dflink-cluster%2Ccomponent%3Dtaskmanager%2Ctype%3Dflink-native-kubernetes&allowWatchBookmarks=true&watch=true. Message: Unauthorized.
...
I am trying deploying my pyflink+beam application on flink operator in GCP K8S. And I got above errors when I run "kubectl apply" for deploying my FlinkDeployment.yaml with the flink operator. I already set ServiceAccount, Role and RoleBinding as well.
This is my FlinkDeployment yaml
Copy code
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: flink-cluster
  namespace: flink
spec:
  serviceAccount: flink
  image: flink-cluster:1.0.0
  imagePullPolicy: IfNotPresent
  flinkVersion: v1_16
  podTemplate:
    spec:
      serviceAccount: flink
      containers:
        - name: flink-main-container
          volumeMounts:
            - mountPath: /opt/flink/log
              name: flink-logs
      volumes:
        - name: flink-logs
          emptyDir: {}
  jobManager:
    resource:
      memory: "2G"
      cpu: 2
  taskManager:
    replicas: 1
    resource:
      memory: "4G"
      cpu: 2
    podTemplate:
      spec:
        serviceAccount: flink
        containers:
          - name: python-job
            image: flink-python-job:1.0.0
            args: ["-worker_pool"]
            ports:
              - containerPort: 50000
                name: job-port
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "5"
p
This error usually means your service account. What is the definition of your service account?
m
here are my SA / role / rolebinding..
Copy code
> kubectl get sa -n flink flink -o yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  annotations:
    helm.sh/resource-policy: keep
...
  name: flink
  namespace: flink
Copy code
> kubectl get role -n flink flink -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    helm.sh/resource-policy: keep
...
  name: flink
  namespace: flink
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - configmaps
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - apps
  resources:
  - deployments
  - deployments/finalizers
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
Copy code
> kubectl get rolebinding -n flink flink-role-binding -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  annotations:
    helm.sh/resource-policy: keep
...
  name: flink-role-binding
  namespace: flink
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: flink
subjects:
- kind: ServiceAccount
  name: flink
  namespace: flink
p
Do you have your SA token inside ``/var/run/secrets/kubernetes.io/serviceaccount`.`?
m
yes.
Copy code
> kubectl exec -n flink -it flink-cluster-68f899db5-xn59t -- ls -l /var/run/secrets/kubernetes.io/serviceaccount/token
lrwxrwxrwx 1 root nogroup 12 Jan 30 09:48 /var/run/secrets/kubernetes.io/serviceaccount/token -> ..data/token
p
That's weird. The error states that this token is unauthorized. Is it possible to recreate the service account?
m
sure, I'll try it! thanks
p
Did it make the trick?
m
something urgent came up so I didn't try that yet 😢 I'll share you soon, thank you!
🙌 1
hi, it was a serviceaccount issue, thanks 🙂
p
Nice! If you need something else, feel free to poke 😄