kubernetes中安装部署Ingress

下载 deploy.yaml

wget https://github.com/kubernetes/ingress-nginx/blob/main/deploy/static/provider/cloud/deploy.yaml
注:下载如果不是yml格式解决办法,可直接访问github下载相关关键

切换镜像

解决方法很简单,用国内好心人搬运到docker hub上的仓库代替
好心人的项目地址:https://github.com/anjia0532/gcr.io_mirror,对应的docker hub地址:https://hub.docker.com/u/anjia0532

下载docker hub上镜像

docker pull anjia0532/google-containers.ingress-nginx.controller:v1.1.1
docker pull anjia0532/google-containers.ingress-nginx.kube-webhook-certgen:v1.1.1

修改deploy.yml文件中的image字段值

image: anjia0532/google-containers.ingress-nginx.controller:v1.1.1
image: anjia0532/google-containers.ingress-nginx.kube-webhook-certgen:v1.1.1

修改deploy.yml文件中的Service

apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/version: 1.1.2
    helm.sh/chart: ingress-nginx-4.0.18
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Local
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - appProtocol: http
    name: http
    port: 80
    protocol: TCP
    targetPort: http
    nodePort: 30080
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: https
    nodePort: 30443
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  # type: LoadBalancer
  type: NodePort

安装运行deploy.yml

kubectl apply -f deploy.yml

查看Ingress

kubectl get all -n ingress-nginx

NAME                                         READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create-xxsw6     0/1     Completed   0          3m3s
pod/ingress-nginx-admission-patch-kvhx7      0/1     Completed   1          3m3s
pod/ingress-nginx-controller-c667849-tvm54   1/1     Running     0          3m3s

NAME                                         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/ingress-nginx-controller             NodePort    10.106.86.94     <none>        80:30080/TCP,443:30443/TCP   3m4s
service/ingress-nginx-controller-admission   ClusterIP   10.106.101.120   <none>        443/TCP                      3m4s

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           3m3s

NAME                                               DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-c667849   1         1         1       3m3s

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           3s         3m3s
job.batch/ingress-nginx-admission-patch    1/1           4s         3m3s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值