tokers commented on a change in pull request #479: URL: https://github.com/apache/apisix-ingress-controller/pull/479#discussion_r638432317
########## File path: docs/en/latest/practices/the-hard-way.md ########## @@ -0,0 +1,826 @@ +--- +title: APISIX Ingress Controller the Hard Way +--- + +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +In this tutorial, we will install APISIX and APISIX Ingress Controller in Kubernetes from native yaml. + +## Prerequisites + +If you don't have a Kubernetes cluster to use, we recommend you to use [KiND](https://kind.sigs.k8s.io/docs/user/quick-start/) to create a local Kubernetes cluster. + +```bash +kubectl create ns apisix +``` + +In this tutorial, all our operations will be performed at namespace `apisix`. + +## ETCD Installation + +Here, we will deploy a single-node ETCD cluster without authentication inside the Kubernetes cluster. + +In this case, we assume you have a storage provisioner. If you are using KiND, a local path provisioner will be created automatically. If you don't have a storage provisioner or don't want to use persistence volume, you could use an `emptyDir` as volume. + +```yaml +# etcd-headless.yaml +apiVersion: v1 +kind: Service +metadata: + name: etcd-headless + labels: + app.kubernetes.io/name: etcd + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + type: ClusterIP + clusterIP: None + ports: + - name: "client" + port: 2379 + targetPort: client + - name: "peer" + port: 2380 + targetPort: peer + selector: + app.kubernetes.io/name: etcd +--- +# etcd.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: etcd + labels: + app.kubernetes.io/name: etcd +spec: + selector: + matchLabels: + app.kubernetes.io/name: etcd + serviceName: etcd-headless + podManagementPolicy: Parallel + replicas: 1 + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + app.kubernetes.io/name: etcd + spec: + securityContext: + fsGroup: 1001 + runAsUser: 1001 + containers: + - name: etcd + image: docker.io/bitnami/etcd:3.4.14-debian-10-r0 + imagePullPolicy: "IfNotPresent" + # command: + # - /scripts/setup.sh + env: + - name: BITNAMI_DEBUG + value: "false" + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: ETCDCTL_API + value: "3" + - name: ETCD_NAME + value: "$(MY_POD_NAME)" + - name: ETCD_DATA_DIR + value: /etcd/data + - name: ETCD_ADVERTISE_CLIENT_URLS + value: "http://$(MY_POD_NAME).etcd-headless.apisix.svc.cluster.local:2379" + - name: ETCD_LISTEN_CLIENT_URLS + value: "http://0.0.0.0:2379" + - name: ETCD_INITIAL_ADVERTISE_PEER_URLS + value: "http://$(MY_POD_NAME).etcd-headless.apisix.svc.cluster.local:2380" + - name: ETCD_LISTEN_PEER_URLS + value: "http://0.0.0.0:2380" + - name: ALLOW_NONE_AUTHENTICATION + value: "yes" + ports: + - name: client + containerPort: 2379 + - name: peer + containerPort: 2380 + volumeMounts: + - name: data + mountPath: /etcd + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "8Gi" +``` + +Apply these two yaml files to Kubernetes, wait few seconds, etcd installation should be successful. We could run a health check to ensure that. + +```bash +$ kubectl -n apisix exec -it etcd-0 -- etcdctl endpoint health +127.0.0.1:2379 is healthy: successfully committed proposal: took = 1.741883ms +``` + +Please notice that this etcd installation is quite simple and lack of many necessary production features, it should only be used for learning case. If you want to deploy a production-ready etcd, please refer [bitnami/etcd](https://bitnami.com/stack/etcd/helm). + +## APISIX Installation + +Create a config file for our APISIX. We are going to deploy APISIX version 2.5. Review comment: OK, got it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
