如何在Kubernetes上调试Pod的初始化

时间:2019-09-30 15:52:18

标签: airflow kubernetes-helm airflow-operator

我正在使用稳定/气流舵图,并且想调试git-clone容器的初始化。根据自述文件,此容器需要一个秘密,该秘密是我创建的,如下所示:

kubectl create secret generic rein-ai-secret --from-file=id_rsa=/home/juanpa/.ssh/airflow-key --from-file=known_hosts=/home/juanpa/.ssh/known_hosts --from-file=id_rsa.pub=/home/juanpa/.ssh/airflow-key.pub

我正在使用一个非常简化的config.yaml

airflow:
  image:
    repository: puckel/docker-airflow
    tag: 1.10.4
  schedulerNumRuns: "-1"
  config:
    AIRFLOW__CORE__DAGS_FOLDER: /usr/local/airflow/repo/data-pipeline/airflow_data/dags
dags:
  path: /usr/local/airflow/repo
  git:
    url: git@github.com:acend-io/data-pipeline.git
    ref: master
    secret: rein-ai-secret
  initContainer:
    enabled: true
    image:
      repository: alpine/git
      tag: 1.0.7
      pullPolicy: IfNotPresent
    installRequirements: false

但是,气流计划程序,airflow-worker和airflow-webserver处于Init:CrashLoopBackOff状态,这意味着它们一直在重新启动。 kubectl describe没有提供足够的信息。如何调试此问题?还是我的secret或config.yaml文件显然有问题?

感谢支持!

1 个答案:

答案 0 :(得分:1)

要进行调试,可以使用git-clone获取 import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class PinchRecyclerView extends RecyclerView { private static final int INVALID_POINTER_ID = -1; private int mActivePointerId = INVALID_POINTER_ID; private ScaleGestureDetector mScaleDetector; private float mScaleFactor = 1.f; private float maxWidth = 0.0f; private float maxHeight = 0.0f; private float mLastTouchX; private float mLastTouchY; private float mPosX; private float mPosY; private float width; private float height; public PinchRecyclerView(Context context) { super(context); if (!isInEditMode()) mScaleDetector = new ScaleGestureDetector(getContext(), new ScaleListener()); } public PinchRecyclerView(Context context, AttributeSet attrs) { super(context, attrs); if (!isInEditMode()) mScaleDetector = new ScaleGestureDetector(getContext(), new ScaleListener()); } public PinchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); if (!isInEditMode()) mScaleDetector = new ScaleGestureDetector(getContext(), new ScaleListener()); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { width = View.MeasureSpec.getSize(widthMeasureSpec); height = View.MeasureSpec.getSize(heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { try { return super.onInterceptTouchEvent(ev); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } return false; } @Override public boolean onTouchEvent(@NonNull MotionEvent ev) { super.onTouchEvent(ev); final int action = ev.getAction(); mScaleDetector.onTouchEvent(ev); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: { final float x = ev.getX(); final float y = ev.getY(); mLastTouchX = x; mLastTouchY = y; mActivePointerId = ev.getPointerId(0); break; } case MotionEvent.ACTION_MOVE: { /* this line is replaced because here came below isssue java.lang.IllegalArgumentException: pointerIndex out of range ref http://stackoverflow.com/questions/6919292/pointerindex-out-of-range-android-multitouch */ //final int pointerIndex = ev.findPointerIndex(mActivePointerId); final int pointerIndex = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; final float x = ev.getX(pointerIndex); final float y = ev.getY(pointerIndex); final float dx = x - mLastTouchX; final float dy = y - mLastTouchY; mPosX += dx; mPosY += dy; if (mPosX > 0.0f) mPosX = 0.0f; else if (mPosX < maxWidth) mPosX = maxWidth; if (mPosY > 0.0f) mPosY = 0.0f; else if (mPosY < maxHeight) mPosY = maxHeight; mLastTouchX = x; mLastTouchY = y; invalidate(); break; } case MotionEvent.ACTION_UP: { mActivePointerId = INVALID_POINTER_ID; break; } case MotionEvent.ACTION_CANCEL: { mActivePointerId = INVALID_POINTER_ID; break; } case MotionEvent.ACTION_POINTER_UP: { final int pointerIndex = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; final int pointerId = ev.getPointerId(pointerIndex); if (pointerId == mActivePointerId) { final int newPointerIndex = pointerIndex == 0 ? 1 : 0; mLastTouchX = ev.getX(newPointerIndex); mLastTouchY = ev.getY(newPointerIndex); mActivePointerId = ev.getPointerId(newPointerIndex); } break; } } return true; } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); canvas.translate(mPosX, mPosY); canvas.scale(mScaleFactor, mScaleFactor); canvas.restore(); } @Override protected void dispatchDraw(@NonNull Canvas canvas) { canvas.save(); if (mScaleFactor == 1.0f) { mPosX = 0.0f; mPosY = 0.0f; } canvas.translate(mPosX, mPosY); canvas.scale(mScaleFactor, mScaleFactor); super.dispatchDraw(canvas); canvas.restore(); invalidate(); } private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { @Override public boolean onScale(ScaleGestureDetector detector) { mScaleFactor *= detector.getScaleFactor(); mScaleFactor = Math.max(1.0f, Math.min(mScaleFactor, 3.0f)); maxWidth = width - (width * mScaleFactor); maxHeight = height - (height * mScaleFactor); invalidate(); return true; } } } bash命令的输出。