minikube 的 kubernetes 入门教程-Nginx Proxy Manager

发布于:2025-09-12 ⋅ 阅读:(18) ⋅ 点赞:(0)

Nginx Proxy Manager (NPM) 是一个基于 Nginx 的反向代理管理工具,旨在简化 Nginx 的配置和管理。它提供了一个直观的 Web 界面,使用户可以轻松地设置和管理反向代理、SSL 证书、访问控制等功能。

创建目录

$ mkdir npm-on-k8s -p
$ cd npm-on-k8s/

启动

在目录中运行以下命令启动Nginx Proxy Manager

$ git clone https://github.com/zimbres/nginx-proxy-manager-on-kubernetes.git
Cloning into 'nginx-proxy-manager-on-kubernetes'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 18 (delta 4), reused 11 (delta 2), pack-reused 0 (from 0)
Receiving objects: 100% (18/18), done.
Resolving deltas: 100% (4/4), done.

$ kubectl apply -k ./
Warning: resource namespaces/npm is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
namespace/npm configured
service/npm-admin-ui created
service/npm-proxy created
persistentvolumeclaim/npm-data created
persistentvolumeclaim/npm-letsencrypt created
deployment.apps/npm created


查看启动的Pod和Service

$ kubectl get pods,svc -n npm
NAME                       READY   STATUS    RESTARTS   AGE
pod/npm-594d6c9d54-h7kjw   1/1     Running   0          2m47s

NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/npm-admin-ui   ClusterIP      10.96.243.154   <none>        81/TCP                       2m48s
service/npm-proxy      LoadBalancer   10.111.68.79    <pending>     80:30569/TCP,443:30631/TCP   2m48s


配置(端口转发)

andy@ThinkPad:~$ kubectl port-forward -n npm service/npm-admin-ui 8080:81
Forwarding from 127.0.0.1:8080 -> 81
Forwarding from [::1]:8080 -> 81
Handling connection for 8080
Handling connection for 8080
Handling connection for 8080
Handling connection for 8080
Handling connection for 8080
Handling connection for 8080

登录凭据

登录地址:http://localhost:8080/
登录凭据:admin@example.com / changeme(登录后更改密码)。


网站公告

今日签到

点亮在社区的每一天
去签到