Skip to content

maguowei/gotok8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goto Kubernetes

github workflow

安装 Kubernetes

安装

详细使用说明请参考 Helm官方文档

$ brew install helm

使用

# 添加 charts repo
$ helm repo add bitnami https://charts.bitnami.com/bitnami

# 测试安装 redis chart
$ helm install my-redis bitnami/redis

# 删除 redis
$ helm uninstall my-redis

部署 Kubernetes Dashboard

$ helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
$ helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard

创建Dashboard管理员用户并用token登陆

# 创建 ServiceAccount admin-user 并绑定集群管理员权限
$ kubectl apply -f https://raw.githubusercontent.com/gotok8s/gotok8s/master/dashboard-adminuser.yaml

# 获取登陆 token
$ kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d

访问Dashboard

$ kubectl -n kubernetes-dashboard port-forward service/kubernetes-dashboard 8443:443

通过下面的连接访问 Dashboard: https://127.0.0.1:8443/

输入上一步获取的token, 验证并登陆。

# install by helm
$ helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
$ helm repo update

$ helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace
$ curl -L https://istio.io/downloadIstio | sh -
# 进入下载的文件夹,这里以 `istio-1.18.1` 为例
$ cd istio-1.18.1
$ export PATH=$PWD/bin:$PATH
# 安装
$ istioctl install --set profile=demo -y
# 设置自动注入 Envoy sidecar proxies
$ kubectl label namespace default istio-injection=enabled

部署示例

# 部署
$ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
# 查看示例返回
$ kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"