Install Istio
Install Istio without ingress/egress by running the following command and paste the the content below into a file call profile-no-gateways.yaml
istioctl install --set profile=minimal
Label the namespace
Label the namespace with ostio-injection=enabled as shown below:
kubectl label namespace default istio-injection=enabled
Please note: when you're running istio, you will noticed that will be 2 container in a pod later
Install the CRDs
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v1.1.0" | kubectl apply -f -
Then install httpbin.yaml that looks like this. You can just use the httpbin.yaml from samples/httpbin folder.
httpbin.yaml
# Copyright Istio Authors
#
# Licensed 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.
##################################################################################################
# httpbin service
##################################################################################################
apiVersion: v1
kind: ServiceAccount
metadata:
name: httpbin
---
apiVersion: v1
kind: Service
metadata:
name: httpbin
labels:
app: httpbin
service: httpbin
spec:
ports:
- name: http
port: 8000
targetPort: 80
selector:
app: httpbin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin
spec:
replicas: 1
selector:
matchLabels:
app: httpbin
version: v1
template:
metadata:
labels:
app: httpbin
version: v1
spec:
serviceAccountName: httpbin
containers:
- image: docker.io/kennethreitz/httpbin
imagePullPolicy: IfNotPresent
name: httpbin
ports:
- containerPort: 80
httpbin-gateway.yaml
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: httpbin-gateway
spec:
gatewayClassName: istio
listeners:
- name: http
hostname: "httpbin.example.com"
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httpbin
spec:
parentRefs:
- name: httpbin-gateway
hostnames: ["httpbin.example.com"]
rules:
- matches:
- path:
type: PathPrefix
value: /status
- path:
type: PathPrefix
value: /delay
backendRefs:
- name: httpbin
port: 8000
Run the following to deploy httpbin app.
kubectl apply -f httpbin.yaml
kubectl apply -f httpbin-gateway.yaml
The httpbin-gateway purpose is to open the application to public. At this point, you will noticed there's 2 pods that's running. httpbin pod has 2 containers.
At this point, you have only istiod. istio-ingress + istio-egress will not be available
And if you run kubectl get svc, you will get the following output. Notice the httpbin-gateway-istio is tied to load balancer with external ip - localhost
To see if your setup works, try running the command below:-
curl -s -I -HHost:httpbin.example.com "http://localhost:80/status/200" -v
Sample output can be shown below:
Repository setup
https://github.com/mitzenjeremywoo/k8s-gateway-api-istio-setup
Comments