{"id":15833864,"url":"https://github.com/kaelzhang/kubernetes-tips","last_synced_at":"2025-04-01T12:27:05.773Z","repository":{"id":65997697,"uuid":"124052165","full_name":"kaelzhang/Kubernetes-Tips","owner":"kaelzhang","description":"Tips for usage of kubernetes and helm","archived":false,"fork":false,"pushed_at":"2019-12-08T07:49:15.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T13:16:16.809Z","etag":null,"topics":["ingress","kubernetes","tips","tutorial"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaelzhang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-06T09:13:59.000Z","updated_at":"2020-02-14T20:39:22.000Z","dependencies_parsed_at":"2023-03-30T05:50:00.555Z","dependency_job_id":null,"html_url":"https://github.com/kaelzhang/Kubernetes-Tips","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"846e1a294d57765f59ccc54c103aa705e434777e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2FKubernetes-Tips","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2FKubernetes-Tips/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2FKubernetes-Tips/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2FKubernetes-Tips/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaelzhang","download_url":"https://codeload.github.com/kaelzhang/Kubernetes-Tips/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246638068,"owners_count":20809733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ingress","kubernetes","tips","tutorial"],"created_at":"2024-10-05T14:00:20.185Z","updated_at":"2025-04-01T12:27:05.752Z","avatar_url":"https://github.com/kaelzhang.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes-Tips\nTips for usage of kubernetes\n\n## The EXTERNAL_IP of LoadBalancer with minikube is always pending\n\nk8s | minikube\n---- | ----\n`1.9.0` |  `0.25.0`\n\nLoadBalancer services run fine on minikube, just with no real external load balancer created. [via](https://github.com/kubernetes/minikube/issues/384#issuecomment-234409957)\n\nLoadBalancer services get a node port assigned too so you can access services via\n\n```sh\nminikube service \u003cname\u003e\n```\n\nto open browser or add `--url` flag to output service URL to terminal.\n\n## How to use local images for a Deployment\n\nSpecify `imagePullPolicy: IfNotPresent` for your container\n\n```yaml\nkind: Deployment\n...\nspec:\n  ...\n  template:\n    spec:\n      containers:\n        - name: NAME\n          image: IMAGE_NAME\n          imagePullPolicy: IfNotPresent\n          ports:\n            - containerPort: 8080\n```\n\n## Why there is no `ADDRESS` of my Ingress when kubectl get ing?\n\nThe yaml file of `Kind: Ingress` specify the rules of your load balancer.\n\nBut the load balancer itself should be provisioned by `ingress-nginx-controller` or other controllers implemented by your Cloud Provider, such as GCE, AWS, Azure, Aliyun, Qcloud, etc.\n\nSo, if you want to create an Ingress on your own, you need to deploy an `ingress-nginx-controller` and a service (which is usually listening port `80`) for it.\n\nCheck [this article](https://hackernoon.com/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45) for how-to. Or it is more convenient to install nginx-ingress by using [helm](https://github.com/helm/charts/tree/master/stable/nginx-ingress).\n\n## How the hell to self-deploy ingress on bare metal without Cloud Provider's support?\n\nCheck [this](https://github.com/kubernetes/ingress-nginx/tree/master/deploy)\n\n## How to make ingress-nginx-controller listen to localhost:80\n\nFor small clusters which means we don't want to use `LoadBalancer` of the cloud provider, does not even expose port 80 on host network? WTF!\n\nAdd `hostNetwork: true` to [`with-rbac.yaml`](https://github.com/kubernetes/ingress-nginx/blob/master/deploy/with-rbac.yaml)\n\n```yaml\n...\nspec:\n  ...\n  template:\n    ...\n    spec:\n      serviceAccountName: nginx-ingress-serviceaccount\n      hostNetwork: true\n      containers:\n        - name: nginx-ingress-controller\n          image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.11.0\n...\n```\n\nOr with helm:\n\n```sh\nhelm install \\\n  --set controller.hostNetwork=true \\\n  --set controller.service.type=NodePort \\\n  stable/nginx-ingress\n```\n\n## Minikube fails to start after (brew cask) upgrade?\n\n```sh\nminikube delete\nrm -rf ~/.minikube\nbrew cask reinstall minikube\n```\n\n- Maybe you need to terminate the process of VMBox (or other virtual machines) which is locking the old version of minikube\n- Maybe you need to upgrade kubernetes\n\n```sh\nbrew upgrade kubernetes-cli\n```\n\n## Helm install: Error: no available release name found\n\n```sh\n$ helm install nginx-ingress\n\nError: no available release name found\n```\n\nAnd also:\n\n## Error: configmaps is forbidden: User \"system:serviceaccount:kube-system:default\" cannot list configmaps in the namespace \"kube-system\"\n\nThis usually happens when using helm with an old kubernetes version. Solution:\n\n```sh\nkubectl create serviceaccount --namespace kube-system tiller\nkubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller\nkubectl patch deploy --namespace kube-system tiller-deploy -p '{\"spec\":{\"template\":{\"spec\":{\"serviceAccount\":\"tiller\"}}}}'\n```\n\n## What is the install order of helm tiller?\n\nThe order of helm install is handled by tiller.\n\nSee [here](https://github.com/helm/helm/blob/master/pkg/tiller/kind_sorter.go#L29)\n\n## Error: could not get apiVersions from Kubernetes: unable to retrieve the complete list of server APIs: domain.com/version: the server is currently unable to handle the request\n\nThe apiservice of kubernetes is not configured correctly. \n\n```sh\nkubectl get apiservice\n```\nto see if there are any unavailable apiservices, and delete them by names\n\n\n# 中国特色\n\n## 因为 helm stable charts registry 被墙，而无法安装 helm charts\n\n```sh\nhelm init \\\n  --tiller-image kaelz/tiller:2.14.1 \\\n  --stable-repo-url https://charts.ost.ai\n```\n\n如果之前安装过 tiller，但是 tiller 已经安装失败：\n\n```sh\nhelm init \\\n  --tiller-image kaelz/tiller:2.14.1 \\\n  --upgrade\n```\n\n## 在云服务器上，尝试使用国外镜像，但是由于 “技术原因” 下载失败\n\n常见错误\n\n```\nTLS shakehand timeout\n```\n\n1. 简单的包装国外镜像\n\nDockerfile\n\n```Dockerfile\nFROM gcr.io/foo/bar:1.0\n```\n\n2. 在本地，或者使用能够 “科学上网” 的构建环境构建（docker build）镜像\n\n3. 然后上传到国内的 registry（hub） 或私有 registry。你也可以 [自己搭建](https://github.com/vmware/harbor)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fkubernetes-tips","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaelzhang%2Fkubernetes-tips","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fkubernetes-tips/lists"}