关于kubernetes:Mac-部署minikube-使用

45次阅读

共计 2141 个字符,预计需要花费 6 分钟才能阅读完成。

install minikube

install helm

brew install kubernetes-helm
# Kubernetes 集群上装置 Helm 服务器:helm init

helm install Prometheus

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm search repo prometheus

# prometheus
helm show values prometheus-community/prometheus > prometheus.yaml

helm install prometheus prometheus-community/prometheus  -f prometheus.yaml
# helm install prometheus prometheus-community/prometheus  -f prometheus.yaml -n kube-server --create-namespace
    
# helm upgrade --install prometheus prometheus-community/prometheus -f prometheus.yaml -n kube-server  --create-namespace --version 15.8.0 --debug

# helm -n kube-server uninstall prometheus 

helm install ingress

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm pull ingress-nginx/ingress-nginx

kubectl create ns ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx

  • hostNetwork 设置为 true
  • dnsPolicy 设置为 ClusterFirstWithHostNet
  • NodeSelector 增加 ingress: “true” 部署至指定节点
  • 类型更改为 kind: DaemonSet
  • type:loadBalancer 改为 ClusterIP

    不倡议 ingress controller 安排在 master 节点,这里就部署一个至 node 节点,生产倡议起码三个,打标签 kubectl label node k8s-node1 ingress=true, 然而我就一个本人的 mac,没必要打标签,DaemonSet 也没必要。

  • error: nginx ingress contrller EXTERNAL-IP pending
kubectl edit -n ingress-nginx service/ingress-nginx-controller
# 增加   externalIPs: 
\kubectl  get svc -n ingress-nginx -owide
NAME                                 TYPE           CLUSTER-IP      EXTERNAL-IP               PORT(S)                      AGE   SELECTOR
ingress-nginx-controller             LoadBalancer   10.105.82.206   localhost,10.31.150.253   80:31828/TCP,443:32728/TCP   18h   app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
ingress-nginx-controller-admission   ClusterIP      10.96.201.230   <none>                    443/TCP                      18h   app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx

  • 查看 IngressClass
litiax9QQ05P ingress-nginx % kubectl get ingressClass
NAME    CONTROLLER             PARAMETERS   AGE
nginx   k8s.io/ingress-nginx   <none>       17h


litixQQ05P /tmp % cat ingress_prometheus.yaml 
apiVersion: networking.k8s.io/v1
kind: Ingress  
metadata:
  name: prometheus-ingress
spec:
  ingressClassName: nginx     # hier
  rules:
  - host: "prometheus.int.xixgshu.com"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: prometheus-server
            port:
              number: 80
test
  • 写本机 host
  • 创立 ingress
  • test

正文完
 0