<|begin▁of▁sentence|># 1.2.2.1.1. 创建第一个应用
## 目标
创建一个名为`kustomization.yaml`的文件,其中包含以下内容:
“`yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
– deployment.yaml
– service.yaml
– configMap.yaml
“`
假设 `deployment.yaml`、`service.yaml` 和 `configMap.yaml` 是已经存在的 Kubernetes 配置文件,它们定义了你的应用。
## 步骤
### 1. 创建资源文件
首先,确保你有所需的 Kubernetes 资源文件。例如:
**deployment.yaml**:
“`yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
– name: my-app
image: my-app:1.0.0
ports:
– containerPort: 80
“`
**service.yaml**:
“`yaml
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
selector:
app: my-app
ports:
– protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
“`
**configMap.yaml**:
“`yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: my-app-config
data:
app.properties: |
color=blue
logging.level=INFO
“`
### 2. 创建 kustomization.yaml
在同一个目录中,创建 `kustomization.yaml` 文件,内容如下:
“`yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
– deployment.yaml
– service.yaml
– configMap.yaml
“`
### 3. 应用配置
使用 `kubectl` 和 `kustomize` 来应用这些配置:
“`bash
kubectl apply -k .
“`
这个命令会处理 `kustomization.yaml` 文件中列出的所有资源,并将它们应用到你的 Kubernetes 集群中。
## 验证
你可以使用以下命令来验证资源是否已成功创建:
“`bash
kubectl get deployments
kubectl get services
kubectl get configmaps
“`
你应该看到名为 `my-app` 的 Deployment 和 Service,以及名为 `my-app-config` 的 ConfigMap。
## 总结
通过这个简单的例子,你学会了如何使用 Kustomize 来管理一组 Kubernetes 资源。你创建了一个 `kustomization.yaml` 文件,其中列出了要管理的资源,然后使用 `kubectl apply -k .` 命令来应用这些资源。这是 Kustomize 最基本的使用方式,后续你将学习如何利用 Kustomize 的更多功能来定制和配置你的应用。
Print
Baked Cajun Chicken Rigatoni in Creamy Garlic Cheese Sauce
5 Stars 4 Stars 3 Stars 2 Stars 1 Star
No reviews
- Author: Chef Billy
Description
A spicy, creamy, and cheesy pasta bake featuring tender Cajun-spiced chicken and rigatoni smothered in a rich garlic cheese sauce, then baked to golden perfection.
Ingredients
For the Crust:
- 1 lb rigatoni pasta
- 2 boneless, skinless chicken breasts, cubed
- 2 tbsp Cajun seasoning
- 4 tbsp butter
- 4 cloves garlic, minced
- 1/4 cup all-purpose flour
- 2 cups whole milk
- 1 cup heavy cream
- 2 cups shredded mozzarella cheese
- 1/2 cup grated Parmesan cheese
- Salt and black pepper to taste
- Fresh parsley, chopped (for garnish)
Instructions
1. Prepare the Crust:
- Preheat oven to 375°F (190°C). Cook rigatoni according to package directions until al dente; drain and set aside.
- Season cubed chicken with Cajun seasoning. In a large skillet, cook chicken over medium-high heat until browned and cooked through, about 6-8 minutes. Remove and set aside.
- In the same skillet, melt butter over medium heat. Add garlic and sauté until fragrant, about 1 minute. Whisk in flour and cook for 1-2 minutes to form a roux.
- Gradually whisk in milk and heavy cream until smooth. Bring to a simmer, stirring constantly, until sauce thickens, about 3-5 minutes.
- Remove from heat and stir in 1 cup mozzarella and all Parmesan until melted and smooth. Season with salt and pepper to taste.
- Combine cooked pasta, chicken, and sauce in a large bowl. Transfer to a greased baking dish, top with remaining mozzarella, and bake for 20-25 minutes until bubbly and golden. Garnish with parsley before serving.
Notes
You can customize the seasonings to taste.
I’m Billy, a classically trained culinary school graduate from The Culinary Institute of America with over 12 years in the restaurant industry and over 19 years of cooking experience.