Skip to content

Instantly share code, notes, and snippets.

@lomocc
Last active January 22, 2018 09:24
Show Gist options
  • Save lomocc/5fcc215e47283ceb1e348ef31a451540 to your computer and use it in GitHub Desktop.
Save lomocc/5fcc215e47283ceb1e348ef31a451540 to your computer and use it in GitHub Desktop.
kubernetes 一些问题和解决方式记录

service_account_key_file

Generate a signing key:

$ openssl genrsa -out /tmp/serviceaccount.key 2048

Update /etc/kubernetes/apiserver:

KUBE_API_ARGS="--service_account_key_file=/tmp/serviceaccount.key"

Update /etc/kubernetes/controller-manager:

KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/tmp/serviceaccount.key"

Ingress

如果要设置外部 path 则需要重写 nginx 路径, https://blog.lomo.cc/2017/12/05/install-kubernetes-troubleshooting/

  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
apiVersion: v1
kind: Pod
metadata:
  name: mysql
spec:
  containers:
  - image: mysql
    name: mysql
    volumeMounts:
    - mountPath: /var/lib/mysql
      name: site-data
  volumes:
  - name: site-data
    hostPath:
      path: /data

容器的 mountPath(/var/lib/mysql) 目录对应到主机的 subPath(/data/mysql) 子目录

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment