kubernetes practice for "LoadBalancer" ====== ###### tags: `kubernetes` `practice` ## command ```shell= gcloud container clusters create k8s-practice --num-nodes 3 --machine-type f1-micro gcloud container clusters list kubectl config get-contexts ``` ```shell= git clone https://github.com/jatins/express-hello-world.git cd express-hello-word docker build -t gcr.io/{PROJECT_ID}/hello-world-image:v1 . gcloud docker -- push gcr.io/{PROJECT_ID}/hello-world-image:v1 ``` ```shell= kubectl create ns hello kubectl create -f deployment.yml -n hello --save-config kubectl expose deployment hello-world-deployment -n hello --type="LoadBalancer" ``` ```shell= kubectl get service -n hello kubectl get deploy -n hello kubectl get pods -n hello kubectl apply -f deployment.yml -n hello ``` ```shell= kubectl delete ns hello kubectl delete -f deployment.yml kubectl delete service/hello-world-deployment gcloud container clusters delete k8s-practice ``` ## deploymemt.yml ```yaml= apiVersion: extensions/v1beta1 kind: Deployment metadata: name: hello-world-deployment spec: replicas: 2 template: metadata: labels: # labels to select/identify the deployment app: hello-world spec: # pod spec containers: - name: hello-world image: gcr.io/bruce-211006/hello-world-image:v3 # image we pushed ports: - containerPort: 3000 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up